Advertisement
veronikaaa86

05. Godzilla vs. Kong

Jan 16th, 2022
431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. package conditionalStatemnents;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P05GodzillaVsKong {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. double budget = Double.parseDouble(scanner.nextLine());
  10. int people = Integer.parseInt(scanner.nextLine());
  11. double priceOneSuits = Double.parseDouble(scanner.nextLine());
  12.  
  13. double decorSum = budget * 0.10;
  14. double sumSuits = people * priceOneSuits;
  15.  
  16. if (people > 150) {
  17. sumSuits = sumSuits * 0.90;
  18. }
  19.  
  20. double totalSum = decorSum + sumSuits;
  21.  
  22. double diff = Math.abs(totalSum - budget);
  23. if (totalSum <= budget) {
  24. System.out.println("Action!");
  25. System.out.printf("Wingard starts filming with %.2f leva left.", diff);
  26. } else {
  27. System.out.println("Not enough money!");
  28. System.out.printf("Wingard needs %.2f leva more.", diff);
  29. }
  30. }
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement