-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScannerTest.java
More file actions
27 lines (25 loc) · 890 Bytes
/
ScannerTest.java
File metadata and controls
27 lines (25 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.util.Scanner;
/**
* Write a description of class ScannerTest here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class ScannerTest
{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
System.out.println("What grade are you in?");
int grade = sc.nextInt();
System.out.println("You are in the " + grade + "th grade \n");
System.out.print("What is your name? ");
sc.nextLine();
String name = sc.nextLine();
System.out.println("Welcome, " + name + "\n");
System.out.println("How much do you get in allowance per week?");
double allowance = sc.nextDouble();
System.out.println("Wow! " + allowance + " is a lot of money");
sc.close();
}
// instance variables - replace the example below with your own
}