Advertisement
finderabc

MaidenParty- Exam - 3 and 4 November 2018

Feb 24th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class EXAM_TASK_If_MaidenParty {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. double priceMaidenParty = Double.parseDouble(scanner.nextLine());
  8.  
  9. int countLoveLetters = Integer.parseInt(scanner.nextLine());
  10. int countWaxRoses = Integer.parseInt(scanner.nextLine());
  11. int countKeyHolders = Integer.parseInt(scanner.nextLine());
  12. int countCartoon = Integer.parseInt(scanner.nextLine());
  13. int countLucky = Integer.parseInt(scanner.nextLine());
  14.  
  15. double sumPriceArticles = countLoveLetters * 0.60 + countWaxRoses * 7.20 + countKeyHolders * 3.60 +
  16. countCartoon * 18.20 + countLucky * 22;
  17. int sumArticles = countLoveLetters + countWaxRoses + countKeyHolders + countCartoon + countLucky;
  18.  
  19. if (sumArticles >= 25){
  20. double discount = sumPriceArticles * 0.35;
  21. sumPriceArticles -= discount;
  22. double hosting = sumPriceArticles * 0.10;
  23. sumPriceArticles -= hosting;
  24.  
  25. sumPriceArticles -=priceMaidenParty;
  26. System.out.printf("Yes! %.2f lv left.", sumPriceArticles);
  27.  
  28.  
  29. }else {
  30. double hosting = sumPriceArticles * 0.10;
  31. sumPriceArticles -= hosting;
  32. priceMaidenParty -= sumPriceArticles;
  33. System.out.printf("Not enough money! %.2f lv needed.", priceMaidenParty);
  34. }
  35.  
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement