Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
33 lines (31 loc) · 1.21 KB

File metadata and controls

33 lines (31 loc) · 1.21 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
import java.util.Scanner;
import java.util.Locale;
import java.text.NumberFormat;
import java.text.DecimalFormat;
public class floor {
public static void main(String[] args) {
String dimensions;
Scanner a = new Scanner( System.in );
Scanner b = new Scanner( System.in );
Scanner c = new Scanner( System.in );
System.out.println("Enter the dimensions of the floor. [w*h]");
dimensions = a.next();
String[] wh = dimensions.split("\\*");
float w = Float.parseFloat(wh[0]);
float h = Float.parseFloat(wh[1]);
float f = (w*h);
System.out.println("Assuming square tile, enter its side length.");
String xb = b.next();
System.out.println("Enter the cost of one tile.");
String yb = c.next();
float x = Float.parseFloat(xb);
float y = Float.parseFloat(yb);
float e = (x*x);
float z = (f/e);
float m = (z*y);
double v = m;
Locale lc = new Locale("en", "US");
NumberFormat currencyFormatter = NumberFormat.getCurrencyInstance(lc);
System.out.println("You would have to buy " + z + " tiles, which would total " + currencyFormatter.format(v) + ".");
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.