File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ import java .util .Scanner ;
2
+ class Account {
3
+ int accountNumber ;
4
+ String accountHolderName ;
5
+ double balance ;
6
+
7
+ Account (int acc_no ,string ac_holder ,double bal )
8
+ {
9
+ accountNumber =acc_no ;
10
+ accountHolderName =ac_holder ;
11
+ balance =bal ;
12
+ }
13
+
14
+ public void deposit (double amount )
15
+ {
16
+ if (amount >0 )
17
+ {
18
+ balance += amount ;
19
+ }
20
+ else
21
+ {
22
+ System .out .println ("Invalid Amount" );
23
+ }
24
+ }
25
+
26
+ public void withdraw (double amount )
27
+ {
28
+ if (amount >0 && amount <=balance )
29
+ {
30
+ balance -= amount ;
31
+ }
32
+ else
33
+ {
34
+ System .out .println ("Amount can't be withdrawn" );
35
+ }
36
+ }
37
+ public void displayAccountInfo ()
38
+ {
39
+ System .out .println ("Account Number:" +accountNumber );
40
+ System .out .println ("Account Number:" +accountHoldername );
41
+ System .out .println ("Balance:" +balance );
42
+ }
43
+
You can’t perform that action at this time.
0 commit comments