- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserInput.java
More file actions
Latest commit
30 lines (22 loc) · 901 Bytes
/
Copy pathUserInput.java
File metadata and controls
30 lines (22 loc) · 901 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
28
29
30
importjava.util.Scanner;
publicclassUserInput{
publicstaticvoidmain(String[] args){
Scannerinput = newScanner(System.in);
System.out.print("Enter your name: ");
Stringname = input.nextline();
System.out.print("Enter your age: ");
byteage = input.nextByte();
System.out.print("Enter your address: ");
Stringaddress = input.nextline();
System.out.print("Enter your account balance: ");
floatbalance = input.nextfloat();
System.out.print("Do you love Java(True/False): ")
booleanisJava = input.nextBoolean();
System.out.println();
System.out.printf("Hello %s, you are welcome to First Bank%n,name);
System.out.printf("Youaccountbalanceis %c%.2f%n","$", balance);
System.out.printf("Your are living in %s %n",address);
System.out.printf("You are %d years old %n,age);
System.out.printf("%sdoyouloveJava? %b%n",name,isJava);
}
}