Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

COMPUTER APPLICATION

2021-2022

NAME: SHAGUN JAISWAL


CLASS: IX
SECTION:C

1. Write a program to add two numbers.

class sum
{
public static void main(String args[ ])
{
int a,b,c=0;
a=45;
b=23;
c=a+b;
System.out.println (“sum=”+c);
}
}
Output=68

2. Write a class with name employee and


basic as its data member, to find the gross
pay of an employee for the following
allowances and deduction. Use
meaningful variables.
Dearness Allowance=25% of the Basic
Pay
House Rent Allowance=15% of Basic Pay
Provident Fund=8.33% of Basic Pay
Net Pay=Basic Pay+Dearness
Allowance+House Rent Allowance
Gross Pay=Net Pay-Provident Fund
class employee
{
public static void main()
{
Double B=50000.0,DA,PF,HRA,NP,GP;
DA=(25*B)/100.0;
HRA=(15*B)/100.0;
PF=(8.33*B)/100.0;
NP=B+DA+HRA;
GP=NP-PF;
System.out.println (“Net pay”+NP+”+GP);
}
}
Output=70,000; 65835

3. Accept two numbers and find the product


of them.

class product
{
public static void main()
{
int a,b,c=0;
a=20;
b=5;
c=a*b;
System.out.println(“Product=”+c);
}
}
Output=100

4. Accept two numbers and find the


difference between them.

class difference
{
public static void main()
{
int a,b,c=0;
a=45;
b=23;
c=a-b;
System.out.println(“Difference=”+c);
}
}
Output=22

5. Accept two numbers and find the quotient


of them.

class quotient
{
public static void main()
{
int a,b,c=0;
a=20;
b=5;
c=20/5;
System.out.println(“Quotient=”+c);
}
}
Output=4

THANK YOU!!!!!

You might also like