Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package stefi;
- import java.util.Scanner;
- public class MatchTickets {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- String category = sc.nextLine();
- double budget = Double.parseDouble(sc.nextLine());
- int people = Integer.parseInt(sc.nextLine());
- double newBudget = 0;
- double moneyleft = 0;
- if (people <= 4) {
- newBudget = (budget - (((double) 75 / 100) * budget));
- }
- if (people > 4 && people < 10) {
- newBudget = (budget - (budget * ((double) 60 / 100)));
- }
- if (people > 9 && people < 25) {
- newBudget = (budget - (budget * ((double) 50 / 100)));
- }
- if (people > 24 && people < 50)
- ;
- newBudget = (budget - (budget * ((double) 40 / 100)));
- {
- if (people > 49) {
- newBudget = (budget - (budget * ((double) 25 / 100)));
- }
- if (category.equalsIgnoreCase("VIP")) {
- moneyleft = newBudget - (people * 499.99);
- } else {
- moneyleft = newBudget - (people * 249.99);
- }
- if (moneyleft > 0) {
- System.out.println("Yes! You have" + moneyleft + "leva left");
- } else {
- System.out.println("Not enough money! You need " + Math.abs(moneyleft) + "leva");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment