-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBank.java
More file actions
24 lines (22 loc) · 808 Bytes
/
Copy pathBank.java
File metadata and controls
24 lines (22 loc) · 808 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
import java.util.Scanner;
public class Bank
{
public static final double OVERDRAWN_PENALTY = 8.00;
public static final double INTEREST_RATE = 0.02; //2% annually
public static void main(String[] args)
{
double balance;
System.out.print("Enter your checking account balance: $");
Scanner keyboard = new Scanner (System.in);
balance = keyboard.nextDouble();
System.out.println("Original balance $"+ balance);
if (balance >=0)
balance = balance + (INTEREST_RATE*balance)/12;
else
balance = balance - OVERDRAWN_PENALTY;
System.out.print("After adjusting for one month ");
System.out.println("of interest and penalties,");
System.out.println("your new balance is $"+balance);
keyboard.close();
}
}