Advertisement
Spocoman

Maiden Party

Sep 7th, 2024
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.15 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         double partyPrice = Double.parseDouble(scanner.nextLine());
  7.         int loveMessageCount = Integer.parseInt(scanner.nextLine()),
  8.                 waxRoseCount = Integer.parseInt(scanner.nextLine()),
  9.                 keychainCount = Integer.parseInt(scanner.nextLine()),
  10.                 caricatureCount = Integer.parseInt(scanner.nextLine()),
  11.                 luckySurpriseCount = Integer.parseInt(scanner.nextLine()),
  12.                 totalCount = loveMessageCount + waxRoseCount + keychainCount + caricatureCount + luckySurpriseCount;
  13.  
  14.         double budget = loveMessageCount * 0.60 + waxRoseCount * 7.20 + keychainCount * 3.60 + caricatureCount * 18.20 + luckySurpriseCount * 22;
  15.  
  16.         if (totalCount >= 25) {
  17.             budget *= 0.65;
  18.         }
  19.  
  20.         budget = budget * 0.9 - partyPrice;
  21.  
  22.         if (budget >= 0) {
  23.             System.out.printf("Yes! %.2f lv left.", budget);
  24.         } else {
  25.             System.out.printf("Not enough money! %.2f lv needed.", Math.abs(budget));
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement