ex4 - System.out.print("Enter the first...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/* class FindMaxOfThree * * Purpose: Using conditional statements */ import java.util.Scanner; // use the Java built-in class Scanner public class FindMaxOfThree { // main method is always the first Java runs in your program public static void main(String args[]) { // You can declare different variables with one line int num1, num2, num3, max; // Read in the three numbers Scanner input = new Scanner( System.in );
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: System.out.print("Enter the first number:"); num1 = input.nextInt(); System.out.print("\nEnter the second number:"); num2 = input.nextInt(); System.out.print("\nEnter the third number:"); num3 = input.nextInt(); // fill in this code during class // print result System.out.printf("%d is the largest number\n",max); } // end of main } // end of class FindMaxOfThree...
View Full Document

This note was uploaded on 12/27/2011 for the course CMPSC 5 taught by Professor Franklin during the Fall '09 term at UCSB.

Ask a homework question - tutors are online