TonyTour

  • package TonyTour;

    import java.text.DecimalFormat;
    import java.util.*;

    public class TonyTour
    {

    private static int participants;
    public static void main(String[] args)
    {
    // Declarations:
    int iChoice;
    Scanner cin = new Scanner(System.in);
    System.out.println(“TonyTour”);
    String name;
    String phone_number;
    System.out.print(” Please enter the name of the person making a booking: “);
    name = cin.nextLine();
    System.out.print(” What is the phone number for this person:”);
    phone_number = cin.nextLine();
    System.out.print(” How many people will be participating in activities:”);
    participants = cin.nextInt();

    System.out.print(“Thankyou.”);

    System.out.println();

    System.out.println();
    // Instantiations:

    // Menu display
    System.out.println(“The following are the activity options you can select to add to your booking:”);
    while(true)
    {
    System.out.println(“1. Day trip to Philip Island Penguin Parade ($70 per person)”);
    System.out.println(“2. Day trip to Werribee Open Plains Zoo ($39.85 per person)”);
    System.out.println(“3. Day trip to Sovereign Hill in Ballarat ($65.50 per person)”);
    System.out.println(“4. 2‐day trip to Buchan Caves in Gippsland ($140 per person)”);
    System.out.println(“5. Western Victoria Great Ocean Rd 2‐day tour ($130.20 per person)”);
    System.out.println(“0. Finished making selections”);
    // Prompt and get choice per instructions
    // Test the user’s choice (1-6 or bad data)
    System.out.print(“What would you like to add to the booking: “);
    iChoice = cin.nextInt();

    switch (iChoice) {
    case 1:
    fvCalcPhilip_sland();
    break;
    case 2:
    fvCalcBuchan();
    break;
    // Continue with menu; be sure to have an “else” for out of range numbers
    case 3:
    fvCalcVictoria();
    break;
    case 4:
    fvCalcWerribee();
    break;
    case 5:
    fvCalcSovereign();
    break;
    case 6:
    quit();
    break;
    default:
    System.out.println(“Error: Valid options are 1 to 6”);
    break;
    }
    }

    }

    // Method to calc and display Philip Island Penguin Parade:
    public static void fvCalcPhilip_sland()
    {

    double cost = 70;
    double credit_card_fee = 12;
    double total;
    double total_cost;
    total = cost * participants;
    total_cost = total + credit_card_fee;

    System.out.println(“Booked activities:”);
    System.out.println(“1. Day trip to Philip Island Penguin Parade ($70 per person)- “+ participants + ” people on 2/9/2022: ” + total );
    System.out.println(“Total cost (includes $12 credit card fee): ” +total_cost);

    }

    // Method to calc and display sphere:
    public static void fvCalcWerribee()
    {
    System.out.println(“2. Day trip to Werribrr Open plains Zoo($39.85 per person)- “+ participants + ” people on 2/9/2022: ” + total );
    System.out.println(“Total cost (includes $12 credit card fee): ” +total_cost);
    }
    }

    // Method to calc and display sphere:
    public static void fvCalcBuchan()
    {
    System.out.println(“3. 2 day trip to Buchan Cves inb GIPPSLAND($140 per person)- “+ participants + ” people on 2/9/2022: ” + total );
    System.out.println(“Total cost (includes $12 credit card fee): ” +total_cost);
    }
    }

    // Method to calc and display cylinder:
    public static void fvCalcVictoria()
    {
    System.out.println(“4. Western victorial great Rd ($139.20 per person)- “+ participants + ” people on 2/9/2022: ” + total );
    System.out.println(“Total cost (includes $12 credit card fee): ” +total_cost);
    }
    // Method to calc and display rectangular solid:
    public static void fvCalcSovereign()
    {
    System.out.println(“5. day trip to sovereign hill in Ballarat ($65.50 per person)- “+ participants + ” people on 2/9/2022: ” + total );
    System.out.println(“Total cost (includes $12 credit card fee): ” +total_cost);

    }
    // Method to exit:
    public static void quit()
    {
    System.out.println(“Finalising booking… “);

    System.exit(0);

    return;
    }
    }

What do you think?

Related Post