-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
31 lines (27 loc) · 741 Bytes
/
Main.java
File metadata and controls
31 lines (27 loc) · 741 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
31
/*
* Simple I/O program.
*/
import java.util.*;
import java.io.*;
public class Main
{
public static void main(String[] args)
{
String name;
int age;
double height;
Scanner sc = new Scanner(System.in);
System.out.println("Please Enter you name");
try{
name = sc.nextLine();
System.out.println("Please Enter you Age in digits");
age = sc.nextInt();
System.out.println("Please Enter you height in digits");
height = sc.nextDouble();
System.out.format("Your name is %s. You are %d years old and you are %.2f foot long.", name,age,height);
}
catch(Exception ex){
System.out.println("Invalid input. Please use numbers for age and height.");
}
}
}