Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design and create a program that calculates simple and compound interest. Simple

ID: 3641557 • Letter: D

Question

Design and create a program that calculates simple and compound interest. Simple interest means that interest is only applied to the original amount. For instance, if a person deposits $1000 at 10% annual interest, then after one year they would have $1100 (the original $1000 plus the $100 interest) and after two years they would have $1200 (the original $1000, plus the $100 earned the first year, plus the $100 earned the second year).

With compound interest, the interest is applied to all money earned. So, starting with $1000 at 10% annual interest, after one year the user would have $1100 (the original amount plus $100 interest) and after two years the user would have $1210 (the $1100 they started with at the beginning of the year plus the $110 interest).

The requirements of this project are:

Prompt the user for the original amount, the type of interest, the interest rate, and whether the interest rate is annual, semi-annual, or quarterly.
Loop the program until the user chooses to quit.
Create a class that will hold methods to calculate the interest.
In the class that is used to calculate the interest, include a method to print to the screen, by interest period, the starting amount for the period, the interest earned for the period, and the total amount at the end of the period.
Submit all of your source code as plain text files with a .java extension.


Sample output ($10000 initial investment, 10% simple interest, annual, for 4 years):

Period Beginning Amount Interest Earned Ending Amount
1 10000.00 1000.00 11000.00
2 11000.00 1000.00 12000.00
3 12000.00 1000.00 13000.00
4 13000.00 1000.00 14000.00

Explanation / Answer

import java.io.*; class Interest { public static void main(String args[])throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); double p,r,t,a=0,intr; int typ,cn=0,cont=1; while(cont!=0) { System.out.print("1.Compound Interest 2.Simple Interest Enter Interest type : "); typ=Integer.parseInt(br.readLine()); System.out.print("Enter Original amount : "); p=Double.parseDouble(br.readLine()); System.out.print("Enter Rate of Interest : "); r=Double.parseDouble(br.readLine()); System.out.print("Enter time period : "); t=Double.parseDouble(br.readLine()); System.out.print("Interest is calculated 1.Annually 2.Semi-Annually 3.Quarterly Enter choice : "); int per=Integer.parseInt(br.readLine()); switch(per) { case 1 : t*=1; break; case 2 : t*=2; break; case 3 : t*=4; break; } if(typ==1) { a=p; System.out.println("Period Beginning Amt Final Amt Interest earned"); while(cn
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote