Keyboard Input #19 (When you finish typing your code... you type MORE!)

Code

    /// Name: Amir Salehi
    /// Period: 7
    /// Program name:  AskingQuestions
    /// File name:  AskingQuestions.java
    /// Date: Finished 9/29/2015
import java.util.Scanner;

public class AskingQuestions
{
	public static void main( String[] args )
	{
		Scanner keyboard = new Scanner(System.in);

		int age;
		String feet;
        String inches;
		double weight;

		System.out.print( "How old are you? " );
		age = keyboard.nextInt();

		System.out.print( "How many feet tall are you? " );
		feet = keyboard.next();
        
        System.out.print( "And how many inches? " );
		inches = keyboard.next();

		System.out.print( "How much do you weigh? " );
		weight = keyboard.nextDouble();

		System.out.println( "So you're " + age + " old, " + feet + "'" + inches + " tall and " + weight + " pounds." );
	}
}
    

Picture of the output

Assignment 7

Back to Homepage