-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBankInterest.java
More file actions
31 lines (26 loc) · 987 Bytes
/
Copy pathBankInterest.java
File metadata and controls
31 lines (26 loc) · 987 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package userInput;
/*
The Bank Interest Program
Automatically calculates amount of bank interests you earn
*/
import java.io.*;
public class BankInterest {
@SuppressWarnings("deprecation")
public static void main(String[] args) throws IOException {
DataInputStream input = new DataInputStream(System.in);
String name;
double bankBalance, intRate, endingBal, totalInt;
System.out.print("Please enter your name: ");
name=input.readLine();
System.out.print("Hello " + name);
System.out.print("Please enter your opening bank balance: $");
bankBalance=Double.parseDouble(input.readLine());
System.out.print("Please enter your rate of interest(ie.4.5) ");
intRate=Double.parseDouble(input.readLine());
totalInt=bankBalance*intRate/100;
endingBal=bankBalance+totalInt;
System.out.println("The interest on your account is $"+totalInt);
System.out.println("");
System.out.println("Your ending balance is "+endingBal);
}
}