E5.18-E5.21 - branching with if... elsePractice of if... else statement:Pick any ONE from E5.18-E5.21 on page 226 (or page 278 in Adobe)
E5.19
import java.util.*;
class Uiyltrg {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
System.out.println("Please enter a value");
double x=in.nextDouble();
System.out.println("Another please");
double y=in.nextDouble();
System.out.println("Another please");
double z=in.nextDouble();
if (x>y && x>z)
{
System.out.println("The largest number is "+x);
}
if (y>x && y>z)
{
System.out.println("The largest number is "+y);
}
if (z>x && z>y)
{
System.out.println("The largest number is "+z);
}
}
}