-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoom.java
More file actions
29 lines (23 loc) · 713 Bytes
/
Room.java
File metadata and controls
29 lines (23 loc) · 713 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
import java.io.*;
import java.text.DecimalFormat;
public class Room{
public static void main(String [] args){
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String input = "";
double length = 0;
double width =0;
DecimalFormat decimal = new DecimalFormat("0.00");
try{
System.out.println("Enter Length:");
input = reader.readLine();
length = Double.parseDouble(input);
System.out.println("Enter width:");
input = reader.readLine();
width = Double.parseDouble(input);
}
catch(IOException e){
System.out.println("error");
}
System.out.println("The floor space of the room is "+ (decimal.format (length*width)) +" square units.");
}
}