Learning Goal: I'm working on a java multi-part question and need an explanation and answer to help me learn.
ASSIGNMENT NO. 1
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 rate (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 yearlyIntRate – the yearly interest rate. Read in from the keyboard.
double monthlyIntRate – computed as yearlyIntRate/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 + monthlyIntRate);
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.
Your assignment:
Read in a monthly deposit of $100 and yearly interest rate of 5.0% and compute the account value for six months
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
ASSIGNMENT NO.2
A shipping company uses the following function to calculate the cost in dollars of shipping based on the weight of the package (in pounds)
Note that if you already checked and the weight is NOT less than or equal 1 pound (say it’s 1.5 pounds), that means it’s automatically greater than one pound so you don’t have to check in the next if statement if it’s greater than 1 pound, since it must be otherwise you would not be testing if it’s less than or equal to 3 pounds. Just check that it’s less than or equal to 3 pounds. No AND or OR conditions are required (which we haven’t learned yet).
Weight
Cost
Less than or equal to 0 pounds display a message “Invalid input”
Less than or equal to 1 pound
$3.50
Greater than 1 but less than or equal to 3 pounds
$5.50
Greater than 3 but less than or equal to 10 pounds
$8.50
Greater than 10 bit less than or equal to 20 pounds
$10.50
If the weight is greater than 20 pounds, display a message “The package can not be shipped”.
Write a program that prompts the user to enter the weight of the package and displays the shipping cost or an appropriate error message.
Test your program with the following inputs:
-10
0
0.5
1
7.25
20
21
!!!"SPECIAL INSTRUCTION : Write a complete Java program, including comments in both the main program and in each method. YOU HAVE TO USE ECLIPSE JAVA IDE
EXPLAIN ALL THE ANSWERS AND I need the whole assignment programming code in google docs. Just copy the code and paste it on google docs and full program from your Java IDE. I need all the answers and all the java code clearly in Java IDE and Google DOCS and I need the answer of the all the questions from the assignment fully cleared. The code have to be perfectly run without any error. And explain everything with answers."!!!