-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProject1.java
More file actions
22 lines (20 loc) · 750 Bytes
/
Copy pathProject1.java
File metadata and controls
22 lines (20 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import java.util.Scanner;
public class Project1 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter your balance:");
double balance = input.nextDouble();
System.out.println("Enter the amount you wanna withdraw: ");
double amount = input.nextDouble();
if (amount > balance) {
System.out.println("Insufficient balance!");
} else if (amount<=0){
System.out.println("Invalid amount");
} else{
balance = balance-amount;
System.out.println("Withdrawal Successful!");
System.out.println("Your new balance is: " + balance);
}
input.close();
}
}