We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e19edf4 commit 51ff096Copy full SHA for 51ff096
Bank Account simulator.java
@@ -0,0 +1,29 @@
1
+class Bank {
2
+ private double balance = 0;
3
+
4
+ void deposit(double amt) {
5
+ balance += amt;
6
+ System.out.println("Deposited: " + amt);
7
+ }
8
9
+ void withdraw(double amt) {
10
+ if (amt > balance) System.out.println("Insufficient balance!");
11
+ else {
12
+ balance -= amt;
13
+ System.out.println("Withdrawn: " + amt);
14
15
16
17
+ void show() {
18
+ System.out.println("Balance = " + balance);
19
20
+}
21
22
+public class BankApp {
23
+ public static void main(String[] args) {
24
+ Bank b = new Bank();
25
+ b.deposit(5000);
26
+ b.withdraw(1200);
27
+ b.show();
28
29
0 commit comments