-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserInput.java
More file actions
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
import java.util.Scanner;
public class UserInput{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.print("Enter your name: ");
String name = input.nextline();
System.out.print("Enter your age: ");
byte age = input.nextByte();
System.out.print("Enter your address: ");
String address = input.nextline();
System.out.print("Enter your account balance: ");
float balance = input.nextfloat();
System.out.print("Do you love Java(True/False): ")
boolean isJava = input.nextBoolean();
System.out.println();
System.out.printf("Hello %s, you are welcome to First Bank%n,name);
System.out.printf("You account balance is %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("%s do you love Java? %b%n",name,isJava);
}
}