Q13. Rewrite the following statements using if-else statement -
a) Int tax = (income > 200000 ) ? 0.10* income :0;
b) Char grade = (percentage >90) ? 'A': 'B';
c) Char gr = (percentage>901 ? 'A': ((percentage>70) ? 'B' : 'C');
d) System.out.println(sales>100000) ? 0.15*sales : 0.10*sales;
Answers
Answered by
0
Int tax = 0
if (income > 200000) {
tax = 0.10 * income
}
Char grade = "B"
if (percentage > 90) {
grade = "A"
}
Char gr = "C"
if (percentage > 90) {
gr = "A"
}
if (percentage > 70) {
gr = "B"
}
if (sales > 100000) {
System.out.println(0.15 * sales)
} else {
System.out.println(0.1 * sales)
}
Similar questions