Advertisement
desislava_topuzakova

01.Sandbox - 07.01.2018

Mar 11th, 2018
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1. package TestJan;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Sandbox {
  6.     public static void main(String[] args) {
  7.        
  8.         Scanner scanner = new Scanner(System.in);
  9.        
  10.         double a = Double.parseDouble(scanner.nextLine());
  11.         double b = Double.parseDouble(scanner.nextLine());
  12.         double price = Double.parseDouble(scanner.nextLine());
  13.         double pricePerKg = Double.parseDouble(scanner.nextLine());
  14.        
  15.         double area = a * b;
  16.         double areaSand = (a - 0.4) * (b - 0.4);
  17.         double borders = area - areaSand;
  18.         double sand = Math.ceil(areaSand * 20);
  19.         double pipes = Math.ceil(borders / 0.44);
  20.         double sum = sand * price + pipes * pricePerKg;
  21.        
  22.         System.out.printf("%.2f", sum);
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement