Advertisement
GabrielHr00

05. Godzilla vs. Kong

Mar 17th, 2024
543
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.96 KB | None | 0 0
  1. package _02_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 muteClothesPrice = Double.parseDouble(scanner.nextLine());
  11.  
  12.         double decor = budget * 0.10;
  13.  
  14.         if(mutesCount > 150) {
  15.             muteClothesPrice = muteClothesPrice * 0.90;
  16.         }
  17.  
  18.         double priceMutesClothing = muteClothesPrice * mutesCount;
  19.         double totalPrice = decor + priceMutesClothing;
  20.  
  21.         double diff = Math.abs(totalPrice - budget);
  22.         if(totalPrice > budget) {
  23.             System.out.printf("Not enough money!%nWingard needs %.2f leva more.", diff);
  24.         } else {
  25.             System.out.printf("Action!%nWingard starts filming with %.2f leva left.", diff);
  26.         }
  27.     }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement