Assignemnt #19
Code
/// Name: Sam Wilson
/// Period: 6
/// Program Name: three_variables
/// File Name: three_variables.java
/// Date Finished: 9/29/2015
import java.util.Scanner;
public class three_variables
{
public static void main( String[] args )
{
String name;
int age;
double salary;
Scanner keyboard = new Scanner(System.in);
System.out.println();
System.out.println( "Hello. What is your name? " );
name = keyboard.next();
System.out.println();
System.out.println( "Hi, " + name + "! How old are you? " );
age = keyboard.nextInt();
System.out.println();
System.out.println("So you're " +age+ ", huh? That's not old at all!");
System.out.println("How much do you make, "+name+ "?");
System.out.print("$");
salary = keyboard.nextDouble();
System.out.println();
System.out.println("$" +salary+ "! I hope that's per hour not year!.");
}
}
Picture of the output