Keyboard Input #22 (It's like the last one, but don't worry the next one will ask for your SSN)

Code

    /// Name: Amir Salehi
    /// Period: 7
    /// Program name:  NameAgeAndSalary
    /// File name:  NameAgeAndSalary.java
    /// Date: Finished 9/30/2015
 import java.util.Scanner;
 
 public class NameAgeAndSalary
 {
     public static void main( String[] args )
     {
         String name;
         int age;
         double income;
 
         Scanner keyboard = new Scanner(System.in);
 
         System.out.print( "Hello. What is your name? " );
         name = keyboard.next();
 
         System.out.print( "Hi, " + name + "! How old are you? " );
         age = keyboard.nextInt();
 
         System.out.println( "So you're " + age + ", eh? That's nice." );
         System.out.print( "How much do you make, " + name + "? " );
         income = keyboard.nextDouble();
 
         System.out.print( income + "! I hope that's per hour and not per year! Lel!" );
     }
 }
    

Picture of the output

Assignment 7

Back to Homepage