You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+34-49Lines changed: 34 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,75 +17,60 @@ functions and describe their differences
17
17
18
18
## Introduction
19
19
20
-
Carefully explain what the student will do in the challenge.
20
+
Today you'll build a mortgage rate calculator that runs in the console. As you learned today, JavaScript is great for adding functionality and interactivity to a webpage. In our exercises today we won't be working with the visual part of the webpage, but the work you do here could be combined with HTML and CSS to create a fully functioning single page application that was.
21
21
22
-
Explain the "why" behind the challenge. Homework for the sake of homework isn't motivating.
22
+
The formula for a monthly mortgage payment is as follows:
23
23
24
-
The module challenge should be the most practical application of the lesson content. It should represent the task or set of tasks that would best prepare the student for an analogous (and likely) real-world scenario.
24
+
```
25
+
M = P [ I ( 1 + I )^N ] / [ ( 1 + I )^N – 1 ]
26
+
```
25
27
26
-
As you provide a clear overview of the module challenge, make certain that the student (not just you) comprehends the relevance of this challenge in helping them realize their own goals of professional development. **It's vital** they understand how this is applicable in the workplace.
28
+
In order to find your monthly payment amount "M,” you need to plug in the following three numbers from your loan:
27
29
28
-
## Completion requirements
30
+
`P` = Principal amount (the total amount borrowed)
31
+
`I` = Interest rate on the mortgage
32
+
`N` = Number of periods (monthly mortgage payments)
29
33
30
-
Here you'll describe the features and tasks that the student will need to complete in order to finish the module challenge.
34
+
Exercises are outlined in the `index.js` file and walk you through a series of steps for building a robust and functional mortgage calculator.
31
35
32
-
Provide all necessary detail in either paragraph form,
33
-
34
-
1. using
35
-
2. a
36
-
3. numbered
37
-
4. list,
38
-
-[ ] or
39
-
-[ ] with
40
-
-[ ] a
41
-
-[ ] checklist.
42
-
43
-
Whatever manner most effectively communicates the information (consider whether a specific sequence is required or if illustrating a clear visual hierarchy would be beneficial).
44
-
45
-
## Stretch goals
46
-
47
-
Describe the tasks and features that would demonstrate a student's exceptional mastery of these principles — going above and beyond — but that exceeds what is required by the minimum expectations of the module challenge.
48
-
49
-
You can do this with full paragraphs or by using a checklist.
50
-
51
-
-[ ] or
52
-
-[ ] by
53
-
-[ ] using
54
-
-[ ] a
55
-
-[ ] checklist
36
+
Check out the resources below for more a step by step walkthrough of this math, and to see a nicely designed mortgage calculator web app. Believe it or not, the backend you write today could power a beautiful site like that!
56
37
57
38
## Instructions
58
39
59
-
You may wish to include an ordered list of step-by-steps instructions to guide the student
40
+
### Task 1: Set up Project
41
+
42
+
Using VSCode and Command Line:
60
43
61
-
1.through
62
-
2.a
63
-
3.sequential
64
-
4.process.
44
+
1.Fork repo and add TL as collaborator on Github.
45
+
2.Clone your fork (not Lambda's repo by mistake!).
46
+
3.`cd` into your newly cloned repository.
47
+
4.Create a new branch by typing `git checkout -b <firstName-lastName>`.
65
48
66
-
##Tests
49
+
### Task 2: Complete MVP Requirements
67
50
68
-
If you're including tests, describe how to run the tests and any setup required. Be as detailed as possible – testing is an area many of our students struggle with.
51
+
Find the `index.js` file and complete the tasks as written. Your final product should be a function called `variableInterestRate` that accepts a `principal`, `interest rate`, `mortgage length`, and `credit score` and returns 10 different options of monthly payments.
69
52
70
-
> Test 1
53
+
### Task 3: Stretch Goals
71
54
72
-
- Instructions
55
+
After you have completed the requirements, try any of the following challenges. As always, note that these may require additional research beyond what you learned in this module.
73
56
74
-
## Testing
57
+
-[ ] Add `Property Tax`, `Homeowner's insurance` and `HOA fees` as parameters in your function to calculate total monthly spend on housing
58
+
-[ ] Build a third calculator that accepts `monthly payment` and `interest rate` and returns the maximum loan that a person could afford
59
+
-[ ] Explore using `window.prompt()` to allow a user to input parameters in the browser
60
+
-[ ] Refactor your `variableInterestRate()` function to accept an array of interest rates (make sure to copy and paste as to not lose your work!)
75
61
76
62
## Submission format
77
63
78
-
Describe how the student should deliver the completed challenge. If it's step-by-step,
64
+
Follow these steps for completing your project.
79
65
80
-
1. include
81
-
2. a
82
-
3. numbered
83
-
4. list.
66
+
-[ ] Submit a Pull-Request to merge `<firstName-lastName>` branch into master. **Please don't merge your own pull request**
67
+
-[ ] Add your TL as a reviewer on the pull-request
68
+
-[ ] Your TL will count the project as complete by merging the branch back into master.
84
69
85
-
## Grading rubric
70
+
## Resources
86
71
87
-
If you've prepared a grading rubric that will be used to evaluate the quality of a student's work on your module challenge assignment, include any instructions or relevant links below.
72
+
🧮 [Detailed Walk-through of Mortgage Calculations](https://www.valuepenguin.com/mortgages/mortgage-payments-calculator)
88
73
89
-
[Grading rubric](example)
74
+
👀 [Mortgage Calculator Web App for Inspiration](https://www.bankrate.com/calculators/mortgages/mortgage-calculator.aspx)
/* Create variables for principal, interest rate, and years. Assign them the values 200000, 0.05, and 30 respectively. Create another value called name and give it the value of your own name.
3
+
*/
4
+
5
+
6
+
7
+
8
+
9
+
// Task 1.5: Simple Math
10
+
/* To create a monthly mortgage rate calculator, we need to know the number of years in months and the monthly interest rate.
11
+
12
+
Create a variable called `monthlyInterestRate` and give it the value of interest rate divided by 12.
13
+
14
+
Create another variable called `periods` and give it the value of years*12.
15
+
*/
16
+
17
+
18
+
3
19
20
+
// Task 2: Harder Math
21
+
/* Create your calculator! Use the formula in the ReadMe to run calculations on your numbers. Save the final value into a variable called monthlyRate.
22
+
23
+
Hint: while these calculations can be done in one line, it might be helpful to create a variable called "numerator" to calculate the numerator, and another called "denominator" to calculate the denominator
24
+
25
+
Hint #2: you'll need to use the `math` object for parts of this calculation!
26
+
27
+
When your math is correct, monthlyRate will equal 1073.64
4
28
*/
5
29
6
-
functiondeclareVariables(){
7
-
// code goes here
8
-
}
9
30
10
-
declareVariables();
11
31
12
-
// Task 2:
13
-
/*
14
32
33
+
// Task 3: Function
34
+
/* Create a function called `mortgageCalculator` that combines all of the steps from task 1 and 2 and returns a sentence "{Name}, your monthly rate is ${monthlyRate}"
35
+
36
+
If your name is `Oscar` mortgageCalculator() should return "Oscar, your monthly rate is 1073.64"
15
37
*/
16
38
17
-
functionmath(){
18
-
// code goes here
19
-
}
20
39
21
-
math();
22
40
23
-
// Task 3:
24
-
/*
25
41
42
+
43
+
// Task 4: Arguments and Parameters
44
+
/* Substitute the variables in your functions for parameters such that you can substitute `P`, `I`, and `N` when you call the function.
45
+
46
+
For example,
47
+
mortgageCalculator(200000, 0.05, 30); <-- should return 1,073.64
26
48
*/
27
49
28
-
functioncontrolFlow(){
29
-
// code goes here
30
-
}
31
50
32
-
controlFlow();
33
51
34
-
// Task 4:
35
-
/*
36
52
53
+
54
+
// Task 5: Conditionals
55
+
/* Add another paramter to your function called credit score. This parameter will be a number between 0 and 800 (a credit score).
56
+
57
+
Then, add control flow within your function such that IF creditScore is above 740, interest rate drops by 0.5%, if credit score is below 660, interest rate increases by 0.5% and if credit score is anywhere between 660 and 740 interest rate doesn't change.
37
58
*/
38
59
39
-
functionloops(){
40
-
// code goes here
41
-
}
42
60
43
-
loops();
44
61
45
-
// Task 5:
46
-
/* Now its time to create your own function!
47
62
63
+
64
+
// Task 6: Loops
65
+
/* Write a new function called variableInterestRate. This function should be the same as mortgageCalculator, except it should return the monthly payment for 10 different interest rates at 0.5% increments plus or minus 2% from the inputted interest rate. Complete these calculations using a for loop.
66
+
67
+
For example, variableInterestRate(20000, 0.04, 30) should return:
68
+
69
+
"{Name}, with an interest rate of 0.02, your monthly rate is $739"
70
+
"{Name}, with an interest rate of 0.025, your monthly rate is $790"
71
+
"{Name}, with an interest rate of 0.03, your monthly rate is $843"
72
+
"{Name}, with an interest rate of 0.035, your monthly rate is $898"
73
+
"{Name}, with an interest rate of 0.04, your monthly rate is $955"
74
+
"{Name}, with an interest rate of 0.045, your monthly rate is $1013"
75
+
"{Name}, with an interest rate of 0.05, your monthly rate is $1074"
76
+
"{Name}, with an interest rate of 0.055, your monthly rate is $1136"
77
+
"{Name}, with an interest rate of 0.06, your monthly rate is $1199"
0 commit comments