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

Cylinder Containers in Java
Homework Solution
$25.00
Java
Programming
Codes
Algorithms
Computer Science
Statements
Variables
Loops
Input
Output
Integers
Strings
Geometry
Mathematics
Cylinder
Radius
Finance
Costs
Containers
Companies
Functions
World Puzzle Problem & Arrays in Java
Homework Solution
$60.00
Java
Programming
Codes
Algorithms
Arrays
Word Puzzles
Input
Output
Running Time
Integers
Loops
Maximum Count
Divide And Conquer Method
Statements
Variables
Recursive Calls
Gradebook Using Java Programming
Homework Solution
$20.00
Java
Programming
Computer Science
Random Numbers
Scores
Students
Input
Output
Loops
Statements
Conditions
Average Values
Variables
Mathematics
Directed Graph in Java
Homework Solution
$40.00
Java
Programming
Codes
Algorithms
Graphs
Nodes
Edges
Dept-First-Search
Statements
Variables
Loops
Variables
Input
Output
Classes in Java Programming
Homework Solution
$20.00
Java
Programming
Coding
Classes
OOP
Instances
Variables
Constructor
Parameters
Loops
Strings
Integers
Conditions
Statements
Setters
Getters
Error Handling
Get help from a qualified tutor
Live Chats