Computer Applications
Rewrite the following program segment using if-else statements instead of the ternary operator:
commission = (sale > 5000) ? sale*10/100 : 0;
Java
Java Operators
100 Likes
Answer
if (sale > 5000)
commission = sale * 10 / 100;
else
commission = 0;
Answered By
60 Likes
Related Questions
Rewrite the following program segment using logical operators:
if(x > 5) if(x > y) System.out.println(x + y);Rewrite the following program segment using if-else statements instead of the ternary operator:
String grade = (marks>=90)?"A": (marks>=80)? "B": "C";
Rewrite the following program segment using if-else statements instead of the ternary operator:
net = (salary > 10000) ? salary - (8.33/100)*salary : salary - (5/100)*salary
Rewrite the following program segment using if-else statements instead of the ternary operator:
s = (a + b < c || a + c <= b || b + c <= a) ? "Triangle is not possible": "Triangle is possible";