java scanner
This commit is contained in:
+28
-1
@@ -1,4 +1,31 @@
|
|||||||
package PACKAGE_NAME;
|
// Ian An
|
||||||
|
// Oct 15 2026
|
||||||
|
// User Input Assignment
|
||||||
|
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class MyText {
|
public class MyText {
|
||||||
|
public static void output() {
|
||||||
|
Scanner s = new Scanner (System.in);
|
||||||
|
|
||||||
|
String name;
|
||||||
|
String lastName;
|
||||||
|
int grade;
|
||||||
|
|
||||||
|
System.out.println("What is your first name?");
|
||||||
|
name = s.nextLine();
|
||||||
|
System.out.println("Hello "+name);
|
||||||
|
|
||||||
|
System.out.println("What is your last name");
|
||||||
|
lastName = s.nextLine();
|
||||||
|
System.out.println("Hello "+lastName);
|
||||||
|
|
||||||
|
System.out.println("What is your grade?");
|
||||||
|
grade = s.nextInt();
|
||||||
|
System.out.printf("So, %s %s, are you really in grade %d?",name,lastName,grade);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
output();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user