Advertisement
veronikaaa86

06. Godzilla vs. Kong

Jun 13th, 2021
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. package conditionalStatements;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P06GodzillaVSKong {
  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 priceOneClothes = Double.parseDouble(scanner.nextLine());
  12.  
  13. double decorSum = budget * 0.10;
  14. double sumClothes = people * priceOneClothes;
  15.  
  16. if (people > 150) {
  17. sumClothes = sumClothes - (sumClothes * 0.10);
  18. }
  19.  
  20. double totalSum = decorSum + sumClothes;
  21.  
  22. double diff = Math.abs(totalSum - budget);
  23. if (totalSum > budget) {
  24. System.out.println("Not enough money!");
  25. System.out.printf("Wingard needs %.2f leva more.", diff);
  26. } else {
  27. System.out.println("Action!");
  28. System.out.printf("Wingard starts filming with %.2f leva left.", diff);
  29. }
  30. }
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement