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 groupNum = Integer.parseInt(scanner.nextLine());
- String typeGroup = scanner.nextLine();
- String day = scanner.nextLine();
- double price = 0.00;
- if (typeGroup.equals ("Students"))
- {
- if (day.equals( "Friday"))
- {
- price = 8.45;
- }
- else if (day.equals( "Saturday"))
- {
- price = 9.80;
- }
- else if (day.equals( "Sunday"))
- {
- price = 10.46;
- }
- }
- else if (typeGroup.equals( "Business"))
- {
- if (day.equals( "Friday"))
- {
- price = 10.90;
- }
- else if (day.equals( "Saturday"))
- {
- price = 15.60;
- }
- else if (day.equals( "Sunday"))
- {
- price = 16;
- }
- }
- else if (typeGroup.equals( "Regular"))
- {
- if (day.equals( "Friday"))
- {
- price = 15;
- }
- else if (day.equals( "Saturday"))
- {
- price = 20;
- }
- else if (day.equals( "Sunday"))
- {
- price = 22.50;
- }
- }
- double totalPrice = groupNum * price;
- double discounted = 0;
- if (typeGroup.equals( "Regular") && groupNum >= 10 && groupNum <= 20)
- {
- discounted = totalPrice * 0.05;
- }
- else if (typeGroup.equals( "Business") && groupNum >= 100)
- {
- discounted = 10 * price;
- }
- else if (typeGroup.equals( "Students" )&& groupNum >= 30)
- {
- discounted = totalPrice * 0.15;
- }
- // Console.WriteLine($"Total price: {totalPrice - discounted:F2}");
- double total= totalPrice- discounted;
- System.out.printf("Total price: %.2f",total);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement