Assignemnt #23 and User Input
Code
///Name: Daniel Tiffany-Appleton
///Period: 7
///Program Name: User Input
///File Name: UserInput
///Date Finished: 9/23/15
import java.util.Scanner;
public class UserInput
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
String firstName, lastName, loginName;
int grade, studentID;
double GPA;
System.out.print( "First name: ");
firstName = keyboard.next();
System.out.print( "Last name: ");
lastName = keyboard.next();
System.out.print( "Grade (9-12): ");
grade = keyboard.nextInt();
System.out.print( "Student ID: ");
studentID = keyboard.nextInt();
System.out.print( "Login: " );
loginName = keyboard.next();
System.out.print( "GPA (0.0-4.0): " );
GPA = keyboard.nextDouble();
System.out.println();
System.out.println( "Your information:" );
System.out.println( " Login: " + loginName );
System.out.println( " ID: " + studentID );
System.out.println( " Name: " + lastName + ", " + firstName );
System.out.println( " GPA: " + GPA );
System.out.println( " Grade: " + grade );
}
}
Picture of the output