|
CS160 Class Wiki Instructors |
Main /
Lab4Solution
public class Lab4 {
public static void main(String[] args)
{
double x = 2.0;
double y = 3.0;
double z = 4.0;
System.out.println("The numbers are: " + x + " " + y + " " + z);
System.out.println("The max is: " + max(x,y,z));
System.out.println("The avg is: " + average(x,y,z));
}
public static double max(double a, double b, double c)
{
return Math.max(a, Math.max(b, c));
}
public static double average(double a, double b, double c)
{
return (a + b + c)/3.0;
}
}
|