Advertisement
GabrielHr00

05. Godzilla vs. Kong

May 21st, 2023
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.10 KB | None | 0 0
  1. package S2_ConditionalStatements;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class GodzillaVsKong {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         double budget = Double.parseDouble(scanner.nextLine());
  9.         int mutesCount = Integer.parseInt(scanner.nextLine());
  10.         double muteClothingPrice = Double.parseDouble(scanner.nextLine());
  11.  
  12.         double totalPriceMutesClothing = mutesCount * muteClothingPrice;
  13.         double decorPrice = budget * 0.10;
  14.  
  15.         if (mutesCount > 150) {
  16.             //totalPriceMutesClothing = totalPriceMutesClothing - (totalPriceMutesClothing * 0.10);
  17.             totalPriceMutesClothing = totalPriceMutesClothing * 0.90;
  18.         }
  19.  
  20.         double finalPrice = decorPrice + totalPriceMutesClothing;
  21.  
  22.         double diff = Math.abs(finalPrice - budget);
  23.         if (budget >= finalPrice) {
  24.             System.out.printf("Action!%nWingard starts filming with %.2f leva left.", diff);
  25.         } else {
  26.             System.out.printf("Not enough money!%nWingard needs %.2f leva more.", diff);
  27.         }
  28.  
  29.     }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement