Question

In: Computer Science

Bank Accounts in Java! Design and implement a Java program that does the following: 1) reads...

Bank Accounts in Java!

Design and implement a Java program that does the following:

1) reads in the principle

2) reads in additional money deposited each year (treat this as a constant)

3) reads in years to grow, and

4) reads in interest rate

And then finally prints out how much money they would have each year.

See below for formatting.

Enter the principle: XX

Enter the annual addition: XX

Enter the number of years to grow: XX

Enter the interest rate as a percentage: XX

Year 0: $XX

Year 1: $XX

Year 2: $XX

Year 3: $XX

Year 4: $XX

Year 5: $XX

Solutions

Expert Solution

Answer:

import java.io.*;
import java.util.Scanner;
class bank
{
public static void main(String[] args)
{
   int principle,additinal_money,years,rate;
   Scanner input = new Scanner(System.in);
  
   System.out.println("Enter the principle: ");
   principle = input.nextInt();
   System.out.println("Enter the annual addition: ");
   additinal_money = input.nextInt();
   System.out.println("Enter the number of years to grow: ");
   years = input.nextInt();
   int [] new_amount = new int[years];
   System.out.println("Enter the interest rate: ");
   rate = input.nextInt();
   for(int i=0;i<years;i++)
   {
      
       new_amount[i] = principle*rate/100;
       principle+= new_amount[i];
       principle = principle+additinal_money;
       new_amount[i] = principle;
   }
   for( int i=0;i<years;i++)
   {
       System.out.println("year"+i+": $"+new_amount[i]);
   }
}
}
      


Related Solutions

1. Design and implement a program that reads a series of integers from the user and...
1. Design and implement a program that reads a series of integers from the user and continually prints their average after every reading. The input stops when the user enters “stop” as the input value. Read each input value as a string, then check if it is “stop” or not. If the string is not “stop”, then, attempt to convert it to an integer using the Integer.parseInt method. If this process throws a NumberFormatException, meaning that the input is not...
Design and implement a program that reads a series of 10 integers from the user and...
Design and implement a program that reads a series of 10 integers from the user and prints their average. Read each input value as a string, and then attempt to convert it to an integer using the Integer.parseInt method. If this process throws a NumberFormatException (meaning that the input is not a valid number), print an appropriate error message and prompt for the number again. Continue reading values until 10 valid integers have been entered.
Design and implement a program that reads a series of 10 integers from the user and...
Design and implement a program that reads a series of 10 integers from the user and prints their average. Read each input value as a string, then attempt to convert it to an integer using the Integer.parseInt method. If this process throws a NumberFormatException (meaning that the input is not a valid integer), display an appropriate error message and prompt for the number again. Continue reading values until 10 valid integers have been entered.
programing language JAVA: Design and implement an application that reads a sentence from the user, then...
programing language JAVA: Design and implement an application that reads a sentence from the user, then counts all the vowels(a, e, i, o, u) in the entire sentence, and prints the number of vowels in the sentence. vowels may be upercase
In C ++, Design and implement a program that reads from the user four integer values...
In C ++, Design and implement a program that reads from the user four integer values between 0 and 100, representing grades. The program then, on separate lines, prints out the entered grades followed by the highest grade, lowest grade, and averages of all four grades. Format the outputs following the sample runs below. Sample run 1: You entered:    95, 80, 100, 70 Highest grade: 100 Lowest grade:   70 Average grade: 86.25
In C++ Design and implement a program (name it ProcessGrades) that reads from the user four...
In C++ Design and implement a program (name it ProcessGrades) that reads from the user four integer values between 0 and 100, representing grades. The program then, on separate lines, prints out the entered grades followed by the highest grade, lowest grade, and averages of all four grades. Format the outputs following the sample runs below.
Write a program in Java Design and implement simple matrix manipulation techniques program in java. Project...
Write a program in Java Design and implement simple matrix manipulation techniques program in java. Project Details: Your program should use 2D arrays to implement simple matrix operations. Your program should do the following: • Read the number of rows and columns of a matrix M1 from the user. Use an input validation loop to make sure the values are greater than 0. • Read the elements of M1 in row major order • Print M1 to the console; make...
Design and implement a Java program that creates a GUI that will allow a customer to...
Design and implement a Java program that creates a GUI that will allow a customer to order pizza and other items from a Pizza Paarlor. The customer should be able to order a variety of items which are listed below. The GUI should allow the customer (viaJavaFX UI Controls - text areas, buttons, checkbox, radio button, etc.) to input the following information: Name of the customer First Name Last Name Phone number of the customer Type of food being order...
Using C# Design and implement a program (name it ProcessGrades) that reads from the user four...
Using C# Design and implement a program (name it ProcessGrades) that reads from the user four integer values between 0 and 100, representing grades. The program then, on separate lines, prints out the entered grades followed by the highest grade, lowest grade, and averages of all four grades. Format the outputs following the sample runs below. Sample run 1: You entered:   95, 80, 100, 70 Highest grade:100 Lowest grade:  70 Average grade:86.25
In Java: Problem 1. Write a program that performs the following two tasks: 1. Reads an...
In Java: Problem 1. Write a program that performs the following two tasks: 1. Reads an arithmetic expression in an infix form, stores it in a queue (infix queue) and converts it to a postfix form (saved in a postfix queue). 2. Evaluates the postfix expression. Use the algorithms described in class/ lecture notes. Use linked lists to implement the Queue and Stack ADTs. Using Java built-in classes will result in 0 points. You must use your own Stack and...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT