Your assignment: 1. Read in a monthly deposit of $100 and yearly interest rate of 5.0% and compute the account value for six months

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Your assignment:
1. Read in a monthly deposit of $100 and yearly interest rate of 5.0% and compute the account value
for six months
2. Using the same code as in part 1, run the program reading in a monthly deposit of $200.50 and
yearly interest rate of 3.75%
Suggestion (but not required) to structure your program:
Declare your variables, initialize monthyValue to 0
Read in monthly deposit and yearly interest rate
Compute monthly interest rate (divide yearly rate by 100 and by 12)
Print monthly deposit amount and yearly interest rate
Compute monthlyValue for the first month using the formula and print the month number and value
Compute monthlyValue for the second month using the formula print the month number and value
Compute monthlyValue for the third month using the formula print the month number and value
Compute monthlyValue for the fourth month using the formula print the month number and value
Compute monthlyValue for the fifth month using the formula print the month number and value
Compute monthlyValue for the sixth month using the formula print the month number and value
Transcribed Image Text:Your assignment: 1. Read in a monthly deposit of $100 and yearly interest rate of 5.0% and compute the account value for six months 2. Using the same code as in part 1, run the program reading in a monthly deposit of $200.50 and yearly interest rate of 3.75% Suggestion (but not required) to structure your program: Declare your variables, initialize monthyValue to 0 Read in monthly deposit and yearly interest rate Compute monthly interest rate (divide yearly rate by 100 and by 12) Print monthly deposit amount and yearly interest rate Compute monthlyValue for the first month using the formula and print the month number and value Compute monthlyValue for the second month using the formula print the month number and value Compute monthlyValue for the third month using the formula print the month number and value Compute monthlyValue for the fourth month using the formula print the month number and value Compute monthlyValue for the fifth month using the formula print the month number and value Compute monthlyValue for the sixth month using the formula print the month number and value
Suppose you deposit the same amount of money in a bank account each month at a given yearly interest
rate and you want to know the value of the account at the end of each month.
Write a program that prompts the user to enter a monthly amount you deposit in the account (could
contain cents) and a yearly interest (e.g., 4.25). The program will first print the values you entered for
monthly deposit and yearly interest rate, followed by the six, monthly calculations showing the month
number and value of the account at the end of each month (with two decimal places) up to and including
the 6th month.
Sample output for $200 monthly deposit and 10% interest rate:
monthly deposit: 200.0 yearly interest rate: 10.0
month 1 value: 201.66
month 2 value: 405.0
month 3 value: 610.04
month 4 value: 816.79
month 5 value: 1025.26
month 6 value: 1235.47
Let's get started. Begin with using the following variables:
double monthlyDeposit - the amount you put into your account each month.
Read in from the keyboad
double yearlylntRate – the yearly interest rate. Read in from the keyboard.
double monthlylntRate – computed as yearlylntRate/100/12
The monthly interest rate is the yearly rate divided by 100 and then divided by 12. For example, a
5% interest rate is converted to .05 for calculation purposes and then .05 is divided by 12 to get a
monthly rate of 0.00417.
double monthlyValue - initialized to 0. Stores the current value of the account at the end of the month using the
formula:
monthlyValue = (monthlyDeposit + monthlyValue) * (1 + monthlylntRate);
After each calculation, print the month number and monthlyValue (see sample output above). Repeat the
calculation for all six months
To help you see what's going on with the calculations, here are the first three.
After the first month, the value of the account (initialzed to 0) becomes
monthlyValue = (200 + 0)*(1+.00833333) which equals 201.66
Note that the monthly interest rate is .00833333 which is 10/100/12
After the second month, the value in the account becomes
monthlyValue = (100 + 201.66) *(1+0.0083333) which equals 405.0 or
(monthy deposit + value at the end of first month) *(1+ monthlyIntRate)
After the third month the account now contains
monthlyValue = (100 + 405.0) *(1+0.00833333) which equals 610.04 or
(monthly deposit + value at the end of second month) *(1+ monthlyIntRate)
and so on.
DO NOT compute the value of the account for each month on paper and then plug it into the program.
Write Java code to do all the computations.
Transcribed Image Text:Suppose you deposit the same amount of money in a bank account each month at a given yearly interest rate and you want to know the value of the account at the end of each month. Write a program that prompts the user to enter a monthly amount you deposit in the account (could contain cents) and a yearly interest (e.g., 4.25). The program will first print the values you entered for monthly deposit and yearly interest rate, followed by the six, monthly calculations showing the month number and value of the account at the end of each month (with two decimal places) up to and including the 6th month. Sample output for $200 monthly deposit and 10% interest rate: monthly deposit: 200.0 yearly interest rate: 10.0 month 1 value: 201.66 month 2 value: 405.0 month 3 value: 610.04 month 4 value: 816.79 month 5 value: 1025.26 month 6 value: 1235.47 Let's get started. Begin with using the following variables: double monthlyDeposit - the amount you put into your account each month. Read in from the keyboad double yearlylntRate – the yearly interest rate. Read in from the keyboard. double monthlylntRate – computed as yearlylntRate/100/12 The monthly interest rate is the yearly rate divided by 100 and then divided by 12. For example, a 5% interest rate is converted to .05 for calculation purposes and then .05 is divided by 12 to get a monthly rate of 0.00417. double monthlyValue - initialized to 0. Stores the current value of the account at the end of the month using the formula: monthlyValue = (monthlyDeposit + monthlyValue) * (1 + monthlylntRate); After each calculation, print the month number and monthlyValue (see sample output above). Repeat the calculation for all six months To help you see what's going on with the calculations, here are the first three. After the first month, the value of the account (initialzed to 0) becomes monthlyValue = (200 + 0)*(1+.00833333) which equals 201.66 Note that the monthly interest rate is .00833333 which is 10/100/12 After the second month, the value in the account becomes monthlyValue = (100 + 201.66) *(1+0.0083333) which equals 405.0 or (monthy deposit + value at the end of first month) *(1+ monthlyIntRate) After the third month the account now contains monthlyValue = (100 + 405.0) *(1+0.00833333) which equals 610.04 or (monthly deposit + value at the end of second month) *(1+ monthlyIntRate) and so on. DO NOT compute the value of the account for each month on paper and then plug it into the program. Write Java code to do all the computations.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY