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...
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
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.
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...
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
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 SumValue) that reads three integers (say X,...
USING C# Design and implement a program (name it SumValue) that reads three integers (say X, Y, and Z) and prints out their values on separate lines with proper labels, followed by their average with proper label. Comment your code properly.Format the outputs following the sample runs below. Sample run 1: X = 7 Y = 8 Z = 10 Average = 8.333333333333334
Implement in Python a script that does the following: 1) reads input from a supposed file...
Implement in Python a script that does the following: 1) reads input from a supposed file called firstnames_2.txt. 2) processes the input and writes and saves the output to a file. NOTE: Please make sure that the names are written in the outfile with one name on each line no comma ( , ) after the name in the output
*Java program* Use while loop 1.) Write a program that reads an integer, and then prints...
*Java program* Use while loop 1.) Write a program that reads an integer, and then prints the sum of the even and odd integers. 2.) Write program to calculate the sum of the following series where in is input by user. (1/1 + 1/2 + 1/3 +..... 1/n)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT