Question

You will be designing and creating 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 problem 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

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

public class Interests {

public static void printByInterestPeriod(double originalAmount, double interestRate, boolean isSimple, int totalPeriods){

// set the 1st period beginning amount to the original amount
double periodBeginningAmount = originalAmount;

// print the header line
System.out.println("\nPeriod Beginning Amount Interest Earned Ending Amount");


for(int period = 1; period <= totalPeriods; period++) {

// print the period number at the start of the line
System.out.print(period + " ");

// print the period's beginning amount
System.out.print(periodBeginningAmount + " ");

double interest = 0;

// if the interest is simple, calculate the earned interest based on the original amount
if(isSimple) {
interest = originalAmount * interestRate;
}...

This is only a preview of the solution. Please use the purchase button to see the entire solution

Related Homework Solutions

Robot Race in Java
Homework Solution
$15.00
Computer Science
Java Programming
Robot Race
Classes
Instances
Objects
Constructors
Strings
Arrays
Tracks
Methods
Directions
Moves
Locations
Characters and Strings in Java
Homework Solution
$5.00
Computer Science
Java Programming
Characters
Strings
Variables
Positions
Indexes
Iterations
Input
Output
Servlets in Java
Homework Solution
$50.00
Computer Science
Java Programming
Hiking Company
Servlets
Web Pages
Users
JSP
Constructors
Classes
Next Stop: Survival Game in Java
Homework Solution
$25.00
Computer Science
Java Programming
Survival Game
Bus Stop
Travelling
Players
Tasks
Challenges
Winning
Losing
Stars
Java Programming Picture Problem
Homework Solution
$40.00
Computer Science
Java Programming
Pictures
Squares
Pixels
Grid
Input
Output
Colors
Statements
Variables
Java Program for University Admissions
Homework Solution
$80.00
Computer Science
Java Programming
University Admission
Candidates
Students
Average Values
Labels
Arrays
Objects
Panels
Get help from a qualified tutor
Live Chats