- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfloor.java
More file actions
Latest commit
33 lines (31 loc) · 1.21 KB
/
Copy pathfloor.java
File metadata and controls
33 lines (31 loc) · 1.21 KB
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
32
33
importjava.util.Scanner;
importjava.util.Locale;
importjava.text.NumberFormat;
importjava.text.DecimalFormat;
publicclassfloor {
publicstaticvoidmain(String[] args) {
Stringdimensions;
Scannera = newScanner( System.in );
Scannerb = newScanner( System.in );
Scannerc = newScanner( System.in );
System.out.println("Enter the dimensions of the floor. [w*h]");
dimensions = a.next();
String[] wh = dimensions.split("\\*");
floatw = Float.parseFloat(wh[0]);
floath = Float.parseFloat(wh[1]);
floatf = (w*h);
System.out.println("Assuming square tile, enter its side length.");
Stringxb = b.next();
System.out.println("Enter the cost of one tile.");
Stringyb = c.next();
floatx = Float.parseFloat(xb);
floaty = Float.parseFloat(yb);
floate = (x*x);
floatz = (f/e);
floatm = (z*y);
doublev = m;
Localelc = newLocale("en", "US");
NumberFormatcurrencyFormatter = NumberFormat.getCurrencyInstance(lc);
System.out.println("You would have to buy " + z + " tiles, which would total " + currencyFormatter.format(v) + ".");
}
}