Assignment #22: Name, Age and Salary
Code
/// Name: Kiran O'Farrell
/// Period: 7
/// Program name: Name, Age & Salary
/// File Name: NameAgeSalary.java
/// Date Finished: 9/21/15
import java.util.Scanner;
public class NameAgeSalary {
public static void main (String[] args) {
Scanner keyboard = new Scanner(System.in);
int age;
double income;
String name;
System.out.print("Hello! What's your name? ");
name = keyboard.next();
System.out.print("Hi, " + name + "! How old are you? ");
age = keyboard.nextInt();
System.out.println( age + "? Great! Here's something else I'd like to know about you. ");
System.out.print("How much do you make? ");
income = keyboard.nextDouble();
System.out.println( income + "? Cool! Thanks for answering my questions.");
}
}
Picture of the output