FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java-Crash-Course/Task/Task11.java at master · sundramsinghdev007/Java-Crash-Course · GitHub
sundramsinghdev007
/
Java-Crash-Course
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
2
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Java-Crash-Course
/
Task
/
Task11.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
59 lines (59 loc) · 1.51 KB
Breadcrumbs
Java-Crash-Course
/
Task
/
Task11.java
Copy path
File metadata and controls
59 lines (59 loc) · 1.51 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import
java
.
util
.*;
class
BankAccount
{
String
Dname
;
String
Atype
;
private
int
Anumber
;
long
Bamount
;
BankAccount
(
int
Actno
)
{
Anumber
=
Actno
;
}
public
void
setDepositor
(
String
depname
,
String
depAtype
,
int
balamount
)
{
Dname
=
depname
;
Atype
=
depAtype
;
Bamount
=
balamount
;
}
public
float
Deposit
(
float
amt
)
{
Bamount
+=
amt
;
return
Bamount
;
}
public
float
Withdraw
(
float
amt
)
{
if
(
amt
==
0
||
amt
>
Bamount
)
{
System
.
out
.
println
(
"Enter Valid Amount ? Thank You!!"
);
}
else
{
Bamount
-=
amt
;
}
return
Bamount
;
}
public
void
Display
()
{
System
.
out
.
println
(
"Department Name="
+
Dname
);
System
.
out
.
println
(
"Account Type="
+
Atype
);
System
.
out
.
println
(
"Account Nmuber"
+
Anumber
);
System
.
out
.
println
(
"Balance Amount"
+
Bamount
);
}
}
class
Task
{
public
static
void
main
(
String
...
args
)
{
long
amt
;
Scanner
sc
=
new
Scanner
(
System
.
in
);
BankAccount
s
=
new
BankAccount
(
15454
);
s
.
setDepositor
(
"Sundram Singh"
,
"Saving"
,
650000
);
s
.
Display
();
System
.
out
.
print
(
"Enter the amount for deposit="
);
amt
=
sc
.
nextInt
();
System
.
out
.
println
(
"Updated Balance is="
+
s
.
Deposit
(
amt
));
System
.
out
.
print
(
"Enter the amount for withdraw="
);
amt
=
sc
.
nextInt
();
System
.
out
.
println
(
"Updated Balance is="
+
s
.
Withdraw
(
amt
));
}
}
Back
|
FazBrowse Home
|
New Git URL