Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double partyPrice = Double.parseDouble(scanner.nextLine());
- int loveMessageCount = Integer.parseInt(scanner.nextLine()),
- waxRoseCount = Integer.parseInt(scanner.nextLine()),
- keychainCount = Integer.parseInt(scanner.nextLine()),
- caricatureCount = Integer.parseInt(scanner.nextLine()),
- luckySurpriseCount = Integer.parseInt(scanner.nextLine()),
- totalCount = loveMessageCount + waxRoseCount + keychainCount + caricatureCount + luckySurpriseCount;
- double budget = loveMessageCount * 0.60 + waxRoseCount * 7.20 + keychainCount * 3.60 + caricatureCount * 18.20 + luckySurpriseCount * 22;
- if (totalCount >= 25) {
- budget *= 0.65;
- }
- budget = budget * 0.9 - partyPrice;
- if (budget >= 0) {
- System.out.printf("Yes! %.2f lv left.", budget);
- } else {
- System.out.printf("Not enough money! %.2f lv needed.", Math.abs(budget));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement