Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Project: Exam_17_July_2016 - created by borkins on 2017-05-16.
- */
- import java.util.Scanner;
- public class _03_MatchTickets
- {
- public static void main(String[] args)
- {
- Scanner console = new Scanner(System.in);
- double budget = Double.parseDouble(console.nextLine());
- String category = console.nextLine();
- int peoples = Integer.parseInt(console.nextLine());
- boolean isVIP = (category.equalsIgnoreCase("vip"));
- double ticketPrice = ((isVIP) ? 499.99 : 249.99) * peoples;
- if (peoples < 5) budget -= budget * 0.75;
- else if (peoples < 10) budget -= budget * 0.60;
- else if (peoples < 25) budget -= budget * 0.50;
- else if (peoples < 50) budget -= budget * 0.40;
- else budget -= budget * 0.25;
- double diffMoney = Math.abs(budget - ticketPrice);
- if (budget >= ticketPrice)
- {
- System.out.printf("Yes! You have %.2f leva left.", diffMoney);
- }
- else {
- System.out.printf("Not enough money! You need %.2f leva.", diffMoney);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment