Question:
a) Change the following example, using the Java's conditional operator expression, to solve the duplication problem.
public class Demonstrate
{ public static void main (String [ ] args)
{ int change = 1 ;
if (change = = 1) {
System.out.print ("The length has changed by");
System.out.print (change);
System.out.println ("minute");
}
else {
System.out.print ("The length has changed by");
System.out.print (change);
System.out.println ("minutes");
}
}
}
b) Prepare a Java program that inputs an integer that represents a temperature on the Fahrenheit scale and then computes and prints its equivalent Celsius value in decimal form. Use the conversion formula C = 5(F-32)/9.