Advertisement
vpaleshnikov

RepairingTheTiles

Apr 15th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.90 KB | None | 0 0
  1. import java.text.DecimalFormat;
  2. import java.util.Scanner;
  3.  
  4. public class Problem01_RepairingTheTiles {
  5.     public static void main(String[] args) {
  6.         Scanner scanner = new Scanner(System.in);
  7.  
  8.         int n = Integer.parseInt(scanner.nextLine());
  9.         double w = Double.parseDouble(scanner.nextLine());
  10.         double l = Double.parseDouble(scanner.nextLine());
  11.         int m = Integer.parseInt(scanner.nextLine());
  12.         int o = Integer.parseInt(scanner.nextLine());
  13.  
  14.         DecimalFormat format = new DecimalFormat("#.############");
  15.  
  16.         int area = n * n;
  17.         int benchArea = m * o;
  18.         int coverArea = area - benchArea;
  19.         double tilesArea = w * l;
  20.         double tilesNeeded = coverArea / tilesArea;
  21.         double timeNeeded = tilesNeeded * 0.2;
  22.  
  23.         System.out.printf("%s%n",format.format(tilesNeeded));
  24.         System.out.printf("%s%n",format.format(timeNeeded));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement