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 scanner = new Scanner(System.in);
- int guestNum = Integer.parseInt(scanner.nextLine());
- double priceOne = Double.parseDouble(scanner.nextLine());
- double budgetDesy = Double.parseDouble(scanner.nextLine());
- if (guestNum >=10&&guestNum<=15)
- {
- priceOne = priceOne - priceOne * 0.15;
- }
- else if (guestNum >=15 && guestNum<=20)
- {
- priceOne = priceOne - priceOne * 0.20;
- } else if (guestNum >= 20)
- {
- priceOne = priceOne - priceOne * 0.25;
- }
- double cakePrice = budgetDesy / 10;
- double finalSum = guestNum * priceOne + cakePrice;
- double residue = finalSum - budgetDesy;
- if (finalSum > budgetDesy){
- System.out.printf("No party! %.2f leva needed.",Math.abs(residue));
- } else {
- System.out.printf("It is party time! %.2f leva left.",Math.abs(residue));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement