Recent Changes - Search:

CS160

Class Wiki

Instructors



edit SideBar

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;
	}
}
Edit - History - Print - Recent Changes - Search
Page last modified on October 01, 2008, at 12:53 PM MST