Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class EXAM_TASK_If_MaidenParty {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double priceMaidenParty = Double.parseDouble(scanner.nextLine());
- int countLoveLetters = Integer.parseInt(scanner.nextLine());
- int countWaxRoses = Integer.parseInt(scanner.nextLine());
- int countKeyHolders = Integer.parseInt(scanner.nextLine());
- int countCartoon = Integer.parseInt(scanner.nextLine());
- int countLucky = Integer.parseInt(scanner.nextLine());
- double sumPriceArticles = countLoveLetters * 0.60 + countWaxRoses * 7.20 + countKeyHolders * 3.60 +
- countCartoon * 18.20 + countLucky * 22;
- int sumArticles = countLoveLetters + countWaxRoses + countKeyHolders + countCartoon + countLucky;
- if (sumArticles >= 25){
- double discount = sumPriceArticles * 0.35;
- sumPriceArticles -= discount;
- double hosting = sumPriceArticles * 0.10;
- sumPriceArticles -= hosting;
- sumPriceArticles -=priceMaidenParty;
- System.out.printf("Yes! %.2f lv left.", sumPriceArticles);
- }else {
- double hosting = sumPriceArticles * 0.10;
- sumPriceArticles -= hosting;
- priceMaidenParty -= sumPriceArticles;
- System.out.printf("Not enough money! %.2f lv needed.", priceMaidenParty);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement