-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBankConditional.java
More file actions
35 lines (33 loc) · 945 Bytes
/
BankConditional.java
File metadata and controls
35 lines (33 loc) · 945 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
32
33
34
35
/* Aditya Bhatia
9/27/2019
Bank Conditionals*/
import java.io.*;
public class BankConditional {
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
double balance = 0;
try
{
System.out.println("Enter balance: ");
balance = Double.parseDouble(br.readLine());
if (balance < 25)
{
System.out.println("You cannot withdraw money");
}
else
{
System.out.println("Enter amount to withdraw: ");
double withdraw = Double.parseDouble(br.readLine());
balance -= withdraw;
System.out.println("Your new balance is: " + balance);
}
}
catch (IOException e)
{
}
catch (Exception x)
{
System.out.println("Please enter a numerical value");
}
}
}