Practical Assignment IX
Practical Assignment IX
Display
the output of the program by taking the side of a square as 25.
Answer:
Answer:
3. A person is paid ₹350 for each day he works and fined ₹309 for each day he remains
absent. Write a program to calculate and display his monthly income if he is present
for 25 days and remains absent for 5 days.
Answer:
double que=150;
double candidate1=que*0.72;
double candidate2=que*0.8;
}
}
5. The normal temperature of human body is 98.6 degree F. Write a program to convert
the temperature into degree Celcius and display the output.
𝑐 𝑓+32
Hint: =
5 9
Answer:
7. Write a program to find and display the value of the given expression:
𝑥+3 2𝑥+5
− ; taking the value of x = 5;
6 3
Answer:
public class Exp1
{
public static void main(String args[]) {
int x = 5;
double value = ((x + 3) / 6.0) - ((2 * x + 5) / 3.0);
System.out.println("Result = " + value);
}
}
8. Write a program using class “Employee’ , while an employee's basic pay is 15000/-.
Calculate the allowances/deductions as given below.
Finally, find and display the Gross and Net pay.
Allowance/Deduction Rate
Dearness Allowance (DA) : 30% of Basic Pay
House Rent Allowance (HRA) : 15% of Basic Pay
Provident Fund (PF) : 12.5% of Basic Pay
Gross Pay = Basic Pay + Dearness Allowance + House Rent Allowance
Net Pay = Gross Pay – Provident Fund
Answer:
public class Employee {
public static void main(String args[]) {
double bp = 15000;
System.out.println("Basic Pay: "+bp);
double da = 0.3 * bp; // DA = 30% of Basic Pay
double hra = 0.15 * bp; // HRA = 15% of Basic Pay
double pf = 0.125 * bp; // PF = 12.5% of Basic Pay
10. Write a program to find out whether the given value if num is an ODD number or an
EVEN number.
Num=4578;
Answer:
if(num % 2 == 0)
System.out.println(num + " is even");
else
System.out.println(num + " is odd");
}
}