Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int guests = Integer.parseInt(scanner.nextLine());
- double envelope = Double.parseDouble(scanner.nextLine()),
- budget = Double.parseDouble(scanner.nextLine()),
- sum = guests * envelope;
- if (guests >= 10 && guests <= 15) {
- sum *= 0.85;
- } else if (guests > 15 && guests <= 20) {
- sum *= 0.80;
- } else if (guests > 20) {
- sum *= 0.75;
- }
- sum += budget / 10;
- if (budget >= sum) {
- System.out.printf("It is party time! %.2f leva left.\n", budget - sum);
- } else {
- System.out.printf("No party! %.2f leva needed.\n", sum - budget);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement