Programming With JAVA
Programming With JAVA
DUMKAL TNSTJTUTE
&
TECHMoLOY
WITH JAVA
PROGRAMING LAB
PATE OF SuBMISSoN-21/o8/21
Write a program to take two teger vajve and peatoem
Solution
Class Commpu
int a
imt b
void add ()
imt S-atb;
(Adhdion of To Nmba is
System 0ut.poitrtlbn
)
void Svb ())
R int d=atb
System.ovt. pirtbr Substraetion s: 4
Void mu ()
int m= afb
System.ovt.paintln ("Multiplication
is : "+m).
void dv ()
intf-0/bh
Syslem .ovt. prtnlln ("Division is : "4{);
C.add C);
CSub );
C.mult C
C. div 0,
Output
Java ass 1
D IJa bap
Number t3 5
Addition of Tuo
Substraution is:5
Multiplication is : 50
Division is 2
5 Creafe a class Big nd defime fwo-member tunefion
owill dake tao nt egca duta Hem trom
Ome fumefion
the and by use of anmother mem br funcBi
input
dha esvt.
biggest Ovt of two and dlsplay
Caleulate the
Soution:
ScaIMer ;
mpoat java .unit.
clossblg
it a
intb
nt
big (t2X, y)
by
Vold max ()
if o )
("value of A is bia"
System ovt. printbn
else
OUtput
JovL OSSI2. Java
D =\Jabap >
D:1 jabep Java as 12
Enter valve for a
5
énler valve for b
yalve ot A is bi
CAn electoieily boatd changes she vale to domertic værs
o discovnage luuge Corsumption of enengy
Solujon-
mpor t java.util.Seamer
ClaSS eleet
elet nd x, Aing y)
tofal units =X
masme
vold Compute ()
doble mn chaaif= (00. 00, tharge= 00.
250
The charg U:
2/5.0