Assignemnt #23
Code
/// Name: Daniel Nguyen
/// Period: 6
/// Program Name: UserInput Program
/// File Name: UserInput.java
/// Date Finished: 9/9/2015
import java.util.Scanner;
public class UserInput
{
public static void main( String[] args )
{
String fname, lname, login;
int grade, id;
double gpa;
Scanner keyboard = new Scanner(System.in);
System.out.println("Please enter the following information so I can sell it for a profit!");
System.out.print( "First name: " );
fname = keyboard.next();
System.out.print( "Last name: " );
lname = keyboard.next();
System.out.print( "Grade (9-12): " );
grade = keyboard.nextInt();
System.out.print( "Student ID: " );
id = keyboard.nextInt();
System.out.print( "Login: " );
login = 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: " + login );
System.out.println( " ID: " + id );
System.out.println( " Name: " + lname + ", " + fname );
System.out.println( " GPA: " + gpa );
System.out.println( " Grade: " + grade );
}
}
Picture of the output