x + 3
Unsolved Java Programming:
1. Write a program to find and display the value of the given expressions
2x + 5
; taking the value of x = 5
6
3
a² + b ² + c²
(b)
; taking the values a=5,b=4,C-3
abc
2. A person is paid 350 for each day he works and fined 30 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.
3. In a competitive examination, there were 150 questions. One candidate got 80%
correct and the other candidate 72% correct. Write a program to calculate and
display the correct answers each candidate got.
4. Write a program to find and display the percentage difference, when:
(a) a number is updated from 80 to 90
(b) a number is updated from 7.5 to 7.2
Answers
Answer:
1)
1) A.
public class KboatExpression
{
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);
}
}
1) B.
public class KboatExpression
{
public static void main(String args[]) {
int a = 5, b = 4, c = 3;
double value = (a * a + b * b + c * c) / (double)(a * b * c);
System.out.println("Result = " + value);
}
}
2)
public class KboatSalary
{
public static void main(String args[]) {
int salary = 25 * 350;
int fine = 5 * 30;
int netSalary = salary - fine;
System.out.println("Monthly Income = " + netSalary);
}
}
3)
public class KboatPercentIncrease
{
public static void main(String args[]) {
int orgNum = 80;
int newNum = 90;
int inc = newNum - orgNum;
double p = inc / (double)orgNum * 100;
System.out.println("Percentage Difference = " + p + "%");
}
}
Explanation:
please I put questions number
please give me brilliant answers please