Advertisement
yovkovbpfps

Exam 12 January 2019 Renovation

Apr 23rd, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class ChangeBurea {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. double budget = Double.parseDouble(scanner.nextLine());
  8. double leghtFloor = Double.parseDouble(scanner.nextLine());
  9. double weightFloor = Double.parseDouble(scanner.nextLine());
  10. double sideTriangle = Double.parseDouble(scanner.nextLine());
  11. double heightTriangle = Double.parseDouble(scanner.nextLine());
  12. double sumOneBath = Double.parseDouble(scanner.nextLine());
  13. double sumMaistor = Double.parseDouble(scanner.nextLine());
  14.  
  15. double ploshtPod = leghtFloor * weightFloor;
  16. double ploshtPlochka = sideTriangle * heightTriangle / 2;
  17. double neededPlochki = Math.ceil(ploshtPod / ploshtPlochka) + 5;
  18. double finalSum = neededPlochki * sumOneBath + sumMaistor;
  19. double ostatuk = Math.abs(finalSum - budget);
  20.  
  21. if (finalSum <= budget){
  22. System.out.printf("%.2f lv left.",ostatuk);
  23. } else {
  24. System.out.printf("You'll need %.2f lv more.",ostatuk);
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement