-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
151 lines (142 loc) · 13.4 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gradebook App</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<h1 class="main-title">Gradebook App</h1>
<!-- Step 1 -->
<div class="description-container">
<h1 id="content-start">Step 1</h1>
<div>
<section id="description">
<p>A teacher has finished grading their students' tests and needs your help to calculate the average score for the class.</p>
<p>Complete the <code>getAverage</code> function which takes in an array of test scores and returns the average score.</p>
<p>The average is calculated by adding up all the scores and dividing by the total number of scores.</p>
<details class="code-details" open="">
<summary class="code-details-summary">Example Code</summary>
<pre class="language-js" tabindex="0" role="region" aria-label="JavaScript code example"><code class="language-js">average <span class="token operator">=</span> sum <span class="token keyword">of</span> all scores <span class="token operator">/</span> total number <span class="token keyword">of</span> scores</code></pre>
</details>
<p>A couple of function calls have been provided for you so you can test out your code.</p>
<p><strong>Tips</strong></p>
<ul>
<li>You can use a loop to iterate over the <code>scores</code> array and add up all the scores.</li>
<li>You can use the <code>length</code> property to get the total number of scores.</li>
</ul>
<details class="code-details" open="">
<summary class="code-details-summary">Ponto de Partida</summary>
<pre class="language-js" tabindex="0" role="region" aria-label="JavaScript code example"><code class="language-js"><span class="token keyword">function</span> <span class="token function">getAverage</span><span class="token punctuation">(</span><span class="token parameter">scores</span>) <span class="token punctuation">{</span><br /><br /><span class="token punctuation">}</span><br /><br />console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token function">getAverage</span><span class="token punctuation">(</span><span class="token punctuation-brackets">[</span><span class="token number">92, 88, 12, 77, 57, 100, 67, 38, 97, 89</span><span class="token punctuation-brackets">]</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span><br />console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token function">getAverage</span><span class="token punctuation">(</span><span class="token punctuation-brackets">[</span><span class="token number">45, 87, 98, 100, 86, 94, 67, 88, 94, 95</span><span class="token punctuation-brackets">]</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</details>
</section>
</div>
</div>
<!-- Step 2 -->
<div class="description-container">
<h1 id="content-start">Step 2</h1>
<div>
<section id="description">
<p>Now the teacher needs your help converting the student score to a letter grade.</p>
<p>Complete the <code>getGrade</code> function that takes a number <code>score</code> as a parameter. Your function should return a string representing a letter grade based on the score.</p>
<p>Here are the scores and their corresponding letter grades:</p>
<table>
<thead>
<tr>
<th>Score Range</th>
<th>Grade</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>100</code></td>
<td><code>"A++"</code></td>
</tr>
<tr>
<td><code>90 - 99</code></td>
<td><code>"A"</code></td>
</tr>
<tr>
<td><code>80 - 89</code></td>
<td><code>"B"</code></td>
</tr>
<tr>
<td><code>70 - 79</code></td>
<td><code>"C"</code></td>
</tr>
<tr>
<td><code>60 - 69</code></td>
<td><code>"D"</code></td>
</tr>
<tr>
<td><code>0 - 59</code></td>
<td><code>"F"</code></td>
</tr>
</tbody>
</table>
<p><strong>Tips</strong></p>
<ul>
<li>Remember that you learned about conditional statements(<code>if</code>, <code>else if</code>, and <code>else</code>).</li>
<li>Remember that you learned about comparison operators (<code>></code>, <code><</code>, <code>>=</code>, <code><=</code>, <code>===</code>).</li>
</ul>
<details class="code-details" open="">
<summary class="code-details-summary">Ponto de Partida</summary>
<pre class="language-js" tabindex="0" role="region" aria-label="JavaScript code example"><code class="language-js"><span class="token keyword">function</span> <span class="token function">getGrade</span><span class="token punctuation">(</span><span class="token parameter">score</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><br><br><span class="token punctuation">}</span><br><br><span class="token keyword">console</span><span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token function">getGrade</span><span class="token punctuation">(</span><span class="token number">96</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span><br><span class="token keyword">console</span><span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token function">getGrade</span><span class="token punctuation">(</span><span class="token number">82</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span><br><span class="token keyword">console</span><span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token function">getGrade</span><span class="token punctuation">(</span><span class="token number">56</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</details>
</section>
</div>
</div>
<!-- Step 3 -->
<div class="description-container">
<h1 id="content-start">Step 3</h1>
<div>
<section id="description">
<p>The teacher is really happy with the program you have created so far. But now they want to have an easy way to check if a student has a passing grade. A passing grade is anything that is not an <code>"F"</code>.</p>
<p>Complete the function <code>hasPassingGrade</code> that takes a student score as a parameter. Your function should return <code>true</code> if the student has a passing grade and <code>false</code> if they do not.</p>
<p><strong>Tips</strong></p>
<ul>
<li>Use the <code>getGrade</code> function to get the student's grade. Then check if the grade is passing or not.</li>
</ul>
<details class="code-details" open="">
<summary class="code-details-summary">Ponto de Partida</summary>
<pre class="language-js" tabindex="0" role="region" aria-label="JavaScript code example"><code class="language-js"><span class="token keyword">function</span> <span class="token function">hasPassingGrade</span><span class="token punctuation">(</span><span class="token parameter">score</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><br><br><span class="token punctuation">}</span><br><br><span class="token keyword">console</span><span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token function">hasPassingGrade</span><span class="token punctuation">(</span><span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span><br><span class="token keyword">console</span><span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token function">hasPassingGrade</span><span class="token punctuation">(</span><span class="token number">53</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span><br><span class="token keyword">console</span><span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token function">hasPassingGrade</span><span class="token punctuation">(</span><span class="token number">87</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</details>
</section>
</div>
</div>
<!-- Step 4 -->
<div class="description-container">
<h1 id="content-start">Step 4</h1>
<div>
<section id="description">
<p>Now that the teacher has all of the information they need, they want to be able to message the student with the results.</p>
<p>Complete the <code>studentMsg</code> function with <code>totalScores</code> and <code>studentScore</code> for parameters. The function should return a string representing a message to the student.</p>
<p>If the student passed the course, the string should follow this format:</p>
<details class="code-details" open="">
<summary class="code-details-summary">Example Code</summary>
<pre class="language-js" tabindex="0" role="region" aria-label="JavaScript code example"><code class="language-js">Class average<span class="token operator">:</span> average<span class="token operator">-</span>goes<span class="token operator">-</span>here<span class="token punctuation">.</span> Your grade<span class="token operator">:</span> grade<span class="token operator">-</span>goes<span class="token operator">-</span>here<span class="token punctuation">.</span> You passed the course<span class="token punctuation">.</span></code></pre>
</details>
<p>If the student failed the course, the string should follow this format:</p>
<details class="code-details" open="">
<summary class="code-details-summary">Example Code</summary>
<pre class="language-js" tabindex="0" role="region" aria-label="JavaScript code example"><code class="language-js">Class average<span class="token operator">:</span> average<span class="token operator">-</span>goes<span class="token operator">-</span>here<span class="token punctuation">.</span> Your grade<span class="token operator">:</span> grade<span class="token operator">-</span>goes<span class="token operator">-</span>here<span class="token punctuation">.</span> You failed the course<span class="token punctuation">.</span></code></pre>
</details>
<p>Replace <code>average-goes-here</code> with the average of the total scores.
Replace <code>grade-goes-here</code> with the student's grade.</p>
<p><strong>Tips</strong></p>
<ul>
<li>Use the <code>getAverage</code> function to get the class average.</li>
<li>Use the <code>getGrade</code> function to get the student's grade.</li>
<li>Use string concatenation (<code>+</code>) to build the message.</li>
<li>Be careful with the punctuation and spaces in the message.</li>
</ul>
<details class="code-details" open="">
<summary class="code-details-summary">Ponto de Partida</summary>
<pre class="language-js" tabindex="0" role="region" aria-label="JavaScript code example"><code class="language-js"><span class="token keyword">function</span> <span class="token function">studentMsg</span><span class="token punctuation">(</span><span class="token parameter">totalScores</span>, <span class="token parameter">studentScore</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><br><br><span class="token punctuation">}</span><br><br><span class="token keyword">console</span><span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token function">studentMsg</span><span class="token punctuation">(</span><span class="token punctuation-brackets">[</span><span class="token number">92, 88, 12, 77, 57, 100, 67, 38, 97, 89</span><span class="token punctuation-brackets">]</span>, <span class="token number">37</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
</details>
</section>
</div>
</div>
</body>
</html>