Advertisement
Guest User

Vtora

a guest
Apr 21st, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class EasterParty {
  4. public static void main(String[] args) {
  5. Scanner sc = new Scanner(System.in);
  6.  
  7. int guestCount = Integer.parseInt(sc.nextLine());
  8. double couvertPriceForOneMan= Double.parseDouble(sc.nextLine());
  9. double budget = Double.parseDouble(sc.nextLine());
  10.  
  11. double discount = 0;
  12. double priceForCake = budget * 0.10;
  13. double sumForParty = 0;
  14.  
  15. if(guestCount >= 10 && guestCount <= 15){
  16. discount = couvertPriceForOneMan * 0.15;
  17. }else if(guestCount > 15 && guestCount <= 20){
  18. discount = couvertPriceForOneMan * 0.20;
  19. }else{
  20. discount = couvertPriceForOneMan * 0.25;
  21. }
  22.  
  23. couvertPriceForOneMan -= discount;
  24.  
  25. sumForParty = guestCount * couvertPriceForOneMan + priceForCake;
  26.  
  27. if(budget > sumForParty){
  28. System.out.printf("It is party time! %.2f leva left.", budget - sumForParty);
  29. }else{
  30. System.out.printf("No party! %.2f leva needed.", sumForParty - budget);
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement