Problem Set 2 - Unit 2 - Simple Programs - Problem-1
Problem Set 2 - Unit 2 - Simple Programs - Problem-1
instead of
Remaining balance: 813.4141998135
So your program only prints out one thing: the remaining balance at the end of the year in the format:
Remaining balance: 4784.0
2.
Test Case 2:
balance = 484
annualInterestRate = 0.2
monthlyPaymentRate = 0.04
Press ESC then TAB or click outside of the code editor to exit
Unanswered
Hints
Only two decimal digits of accuracy?
Use the round function at the end of your code!
How to think about this problem?
To help you get started, here is a rough outline of the stages you should probably follow in writing your code:
For each month:
Compute the monthly payment, based on the previous month’s balance.
Update the outstanding balance by removing the payment, then charging interest on the result.
Output the month, the minimum monthly payment and the remaining balance.
Keep track of the total amount of paid over all the past months so far.
Print out the result statement with the total amount paid and the remaining balance.
Use these ideas to guide the creation of your code.
Important
Only hit "Check" once per submission. You only get 30 checks per problem.
** O t ti d tk f i t t d ith f db k If hit "Ch k" lti l ti
** Our automatic grader may take a few minutes to respond with feedback. If you hit "Check" multiple times, you
will lose a check for every press of the button.
** If you're unfamiliar with how our autograder works, first try out one of the infinite check problems in the
Functions lecture sequence.
** Please be judicious with your checks, as we are unable to give you more than 30 checks. However this should
be more than sufficient: if you do your code development in your local environment, and ensure you can pass our
test cases, you should not require more than a few checks once you paste your working, tested code into our
code box.
If you believe you have correct code but it is marked incorrect after clicking "Check"...
** After you submit your code, you can see every test case the graders runs on your code. They compare what
your code outputs with what our answer code is supposed to output. Click the small link titled "See Full Output"
below the Test Results header.
"Staff Debug: L397 Error" means your code has an infinite loop...
** Clicking Check may give you the error:
There was a problem running your solution (Staff debug: L379).
We couldn't run your solution (Staff debug: L397). .
This means your code is taking too long or has an infinite loop. Test your code with more unique test cases, such
as very large or very small values.
Do not define your own values
** For problems such as these, do not include input statements or define variables we told you would be given.
Our automated testing will provide values for you - so write your code in the following box assuming those
variables are already defined. The code you paste into the following box should not specify the values for the
variables balance , annualInterestRate , or monthlyPaymentRate