Skip to content

Commit 38fb0c7

Browse files
Merge pull request uagc-it-readiness#8 from robinsonaaron/master
Added assignment 5
2 parents 5fee8a3 + 6aaa985 commit 38fb0c7

File tree

5 files changed

+41
-1
lines changed

5 files changed

+41
-1
lines changed

02-javascript/assignment-4/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
##Assignment 4 - Objects
22

3-
* Create a JavaScript that represents a person with properties that describe the person
3+
* Create a JavaScript object that represents a person with properties that describe the person
44
* Add a property to hold the person's age
55
* Add a property to the person that represents his/her children. This will be an array of person objects that describe the children.
66
* Add a function called celebrateBirthday that increments the person's age

02-javascript/assignment-5/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## Assignment 5 - DOM - Savings Calculator
2+
Create a savings calculator that will calculate how much a savings account would generate each month if compounded monthly.
3+
4+
1. Open index.html and main.js in your code editor.
5+
2. Add an h3 header with the text "Savings Calculator".
6+
3. Add an opening and closing p tag
7+
4. Within the p tag, add "Starting amount: ".
8+
5. Immediate afterward the text add an input tag with an attribute of type="number", also give it an id of "amount".
9+
```
10+
<p>
11+
Starting amount: <input type="text" id="amount" />
12+
</p>
13+
```
14+
6. Repeat steps 3 through 5 to create another input field for the rate of return with the text "Rate of return (percent): " and an id attribute of "rate".
15+
7. Repeat steps 3 through 5 to create another input field for the rate of number of years with the text "Years: " and an id attribute of "years".
16+
8. Add two input tags with a type of "button".
17+
9. Give the first button a value attribute of "Calculate" and an onclick attribute that is equal to "calculate()".
18+
10. Give the second button a value attribute of "Reset" and an onclick attribute that is equal to "reset()".
19+
11. Add another p tag with in id of "results_table" that will hold the generated results table.
20+
12. Open the main.js file and define the calculate and reset functions. calculate should generate a view like that below. reset should clear out the results table. <br>
21+
![Results Image](assignment-5-results.JPG?raw=true)
22+
23+
Hints
24+
* To calculate the interest earned for the first month use 'amount * ((rate / 100)/12)'
25+
* inputElement.value returns a string. Convert it to a number with parseFloat(value)
26+
* To round a value to two decimal places use Math.round(myNum * 100) / 100
27+
* To display a number with two decimal places so that 500.50 isn't shown as 500.5, use myNum.toFixed(2).
Loading

02-javascript/assignment-5/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<html>
2+
<head>
3+
<style>
4+
/* Defines a cleaner look for tables */
5+
table { border-collapse: collapse; }
6+
td, th { border: 1px solid black; padding: 3px 8px; }
7+
th { text-align: left; }
8+
</style>
9+
<script type="text/javascript" src="main.js" ></script>
10+
</head>
11+
<body>
12+
</body>
13+
</html>

02-javascript/assignment-5/main.js

Whitespace-only changes.

0 commit comments

Comments
 (0)