Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class EasterParty {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int guestCount = Integer.parseInt(sc.nextLine());
- double couvertPriceForOneMan= Double.parseDouble(sc.nextLine());
- double budget = Double.parseDouble(sc.nextLine());
- double discount = 0;
- double priceForCake = budget * 0.10;
- double sumForParty = 0;
- if(guestCount >= 10 && guestCount <= 15){
- discount = couvertPriceForOneMan * 0.15;
- }else if(guestCount > 15 && guestCount <= 20){
- discount = couvertPriceForOneMan * 0.20;
- }else{
- discount = couvertPriceForOneMan * 0.25;
- }
- couvertPriceForOneMan -= discount;
- sumForParty = guestCount * couvertPriceForOneMan + priceForCake;
- if(budget > sumForParty){
- System.out.printf("It is party time! %.2f leva left.", budget - sumForParty);
- }else{
- System.out.printf("No party! %.2f leva needed.", sumForParty - budget);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement