Assignemnt #19 Asking Questions
Code
Name: Iaroslav Titov
Period: 7
Project Name: AskingQuestions
File Name: AskingQuestions.java
Date: 9/22/2015
import java.util.Scanner;
import java.util.InputMismatchException;
public class AskingQuestions
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int age;
int inches;
int feet;
double weight;
try
{
System.out.print( "How old are you? " );
age = keyboard.nextInt();
System.out.print( "How many feet tall are you? " );
feet = keyboard.nextInt();
System.out.print( "How many inches tall are you? " );
inches = keyboard.nextInt();
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." );
}
catch (InputMismatchException e)
{
System.out.println("You typed in wrong information!!!");
}
}
}
Picture of the output