Public feed
#727158
/* An involved program! Written by Karen Laws. Oct. 2007
This averages the numbers the user types on the screen. */
import java.util.Scanner;
public class Assignment1
{
public static void main( String args[] )
{
int x; //create a variable x to old integer
int y;
int z;
/* create an object named input, which is supposed to read in data
from the keyboard */
Scanner input;
input=new Scanner(System.in);
System.out.println("Please enter a whole number for x: ");
/* read in the data from the keyboard, using the method nextInt() */
x=input.nextInt( );
System.out.println("Please enter another whole number for y: ");
y=input.nextInt( );
System.out.println("Please enter another whole number for z: ");
z=input.nextInt( );
int A;
A=x+y+z;
int B;
B=A/3;
/* echo the entered number onto the screen*/
System.out.println("The average is" + B + ".");
}
}