FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java-Lab-File-Programs/Q13_SumAndSub_Pack.java at main · sagargoswami2001/Java-Lab-File-Programs · GitHub
sagargoswami2001
/
Java-Lab-File-Programs
Public
Notifications
You must be signed in to change notification settings
Fork
3
Star
7
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-Lab-File-Programs
/
Q13_SumAndSub_Pack.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
30 lines (26 loc) · 790 Bytes
Breadcrumbs
Java-Lab-File-Programs
/
Q13_SumAndSub_Pack.java
Copy path
File metadata and controls
30 lines (26 loc) · 790 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
//Q13. WAP to create a package Calc with methods Sum() & Sub() and show the Implementation in a class.
package
JAVA_Lab_File
;
import
Calc
.
Add
;
import
Calc
.
Subtract
;
import
java
.
util
.
Scanner
;
public
class
Q13_SumAndSub_Pack
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
"Sum "
);
System
.
out
.
println
(
"Subtract "
);
System
.
out
.
print
(
"Enter your choice: "
);
Scanner
sc
=
new
Scanner
(
System
.
in
);
int
t
=
sc
.
nextInt
();
switch
(
t
) {
case
1
-> {
Add
a
=
new
Add
();
a
.
sum
();
}
case
2
-> {
Subtract
s
=
new
Subtract
();
s
.
subtract
();
}
default
->
System
.
out
.
println
(
"invalid choice"
);
}
}
}
Back
|
FazBrowse Home
|
New Git URL