FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java-Programs/ClassAndObjects/Bank.java at master · jogkunal5/Java-Programs · GitHub
jogkunal5
/
Java-Programs
Public
forked from
divScorp/Java-Programs
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Java-Programs
/
ClassAndObjects
/
Bank.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
44 lines (35 loc) · 883 Bytes
Breadcrumbs
Java-Programs
/
ClassAndObjects
/
Bank.java
Copy path
File metadata and controls
44 lines (35 loc) · 883 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
36
37
38
39
40
41
42
43
44
package
ClassAndObjects
;
class
BankAccount
{
int
accountNum
=
0
;
float
accountBalance
=
0
;
public
BankAccount
() {
}
public
BankAccount
(
int
accountNumber
,
float
balance
) {
accountNum
=
accountNumber
;
accountBalance
=
balance
;
}
void
setAccountNumber
(
int
num
) {
accountNum
=
num
;
}
void
withdraw
(
float
amount
) {
accountBalance
=
accountBalance
-
amount
;
}
void
deposit
(
float
amount
) {
accountBalance
=
accountBalance
+
amount
;
}
void
status
(){
System
.
out
.
println
(
"Account Number: "
+
accountNum
);
System
.
out
.
println
(
"Account Balance: "
+
accountBalance
);
}
}
public
class
Bank
{
public
static
void
main
(
String
[]
arg
) {
BankAccount
account1
=
new
BankAccount
();
account1
.
setAccountNumber
(
456
);
account1
.
deposit
(
1000
);
account1
.
status
();
BankAccount
account2
=
new
BankAccount
(
142
,
2000
);
account2
.
withdraw
(
500
);
account2
.
status
();
}
}
Back
|
FazBrowse Home
|
New Git URL