Advertisement
galinyotsev123

ProgBasicsExam12January2019-E02Renovation

Jan 26th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. double budget = Double.parseDouble(scanner.nextLine());
  8. double width = Double.parseDouble(scanner.nextLine());
  9. double length = Double.parseDouble(scanner.nextLine());
  10. double a = Double.parseDouble(scanner.nextLine());
  11. double h = Double.parseDouble(scanner.nextLine());
  12. double pricePerTiles = Double.parseDouble(scanner.nextLine());
  13. double labourPrice = Double.parseDouble(scanner.nextLine());
  14.  
  15. double squareMeters = width * length;
  16. double tilesSquareMeters = a * h / 2;
  17. double neededTiles = Math.ceil((squareMeters / tilesSquareMeters) + 5);
  18.  
  19. double totalSum = (neededTiles * pricePerTiles) + labourPrice;
  20.  
  21. if (totalSum <= budget) {
  22. System.out.printf("%.2f lv left.", budget - totalSum);
  23. } else {
  24. System.out.printf("You'll need %.2f lv more.", totalSum - budget);
  25. }
  26.  
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement