package quantockcoaches;
import java.util.*;
/**
*
* @author Jordan Southey
*/
public class QuantockCoaches
{
public static void main(String[] args){
int MenuOption, TripID, ChoosenTripID, NewNoOfAdults, NewNoOfChildren;
String NewFirstName, NewSurname, NewTelNumber, NewAddress1, NewAddress2,
NewCity, NewCounty, NewPostcode;
ArrayList <TripCatalogue> Trips = new ArrayList();
Trips.add(new TripCatalogue("QC01", "Bridgwater to Wells", 25.00));
Trips.add(new TripCatalogue("QC02", "Bridgwater to Bristol", 25.00));
Trips.add(new TripCatalogue("QC03", "Bridgwater to London", 25.00));
Trips.add(new TripCatalogue("QC04", "Bridgwater to Manchester", 25.00));
Trips.add(new TripCatalogue("QC05", "Bridgwater to Leeds", 25.00));
Trips.add(new TripCatalogue("QC06", "Bridgwater to Liverpool", 25.00));
Trips.add(new TripCatalogue("QC07", "Bridgwater to Edinburgh", 25.00));
Trips.add(new TripCatalogue("QC08", "Bridgwater to Glasow", 25.00));
Trips.add(new TripCatalogue("QC09", "Bridgwater to Heathrow", 25.00));
Trips.add(new TripCatalogue("QC010", "Bridgwater to Plymouth", 25.00));
Trips.add(new TripCatalogue("QC011", "Bridgwater to Landsend", 25.00));
Trips.add(new TripCatalogue("QC012", "Bridgwater to Padstow", 25.00));
Scanner Scanner;
Scanner InputScanner;
Scanner BillingAndTicketingScanner;
Scanner ViewScanner;
Scanner TripCatalogueScanner;
for(;;){
do{
System.out.println("Quantock Coaches Booking System V1.0");
System.out.println("What type of operation do you wish to perform?");
System.out.println("1: Check Coach Seats.");
System.out.println("2: Create New Booking.");
System.out.println("3: View / Delete Bookings.");
System.out.println("4: Exit Program.");
Scanner = new Scanner(System.in);
MenuOption = Scanner.nextInt();
}while (MenuOption < 1 || MenuOption > 4);
if (MenuOption == 0)
break;
switch (MenuOption){
case 1:
{
TripCatalogueScanner = new Scanner(System.in);
System.out.println("Please select the trip by entering the ID numbers E.G. 12");
for (int i = 0; i < Trips.size();i++)
System.out.println(Trips.get(i).toString());
ChoosenTripID = TripCatalogueScanner.nextInt();
System.out.println("Selected Trip: " + ChoosenTripID);
System.out.println("Total seating space is 32");
System.out.println("Free seats remaining: " + Trips.get(ChoosenTripID-1).AvalibleSeats() + "\n");
break;
}
case 2:
{
InputScanner = new Scanner(System.in);
System.out.println("Please select the trip by entering the ID numbers E.G. 12");
for (int i = 0; i < Trips.size();i++)
System.out.println(Trips.get(i).toString());
ChoosenTripID = InputScanner.nextInt();
System.out.println("Please enter the customer's first name: ");
InputScanner.nextLine();
NewFirstName = InputScanner.nextLine();
System.out.println("Please enter the customer's surname: ");
NewSurname = InputScanner.nextLine();
System.out.println("Please enter the customer's telephone number: ");
NewTelNumber = InputScanner.nextLine();
System.out.println("Please enter the customer's first address line: ");
NewAddress1 = InputScanner.nextLine();
System.out.println("Please enter the customer's second address line: ");
NewAddress2 = InputScanner.nextLine();
System.out.println("Please enter the customer's town or city: ");
NewCity = InputScanner.nextLine();
System.out.println("Please enter the customer's county: ");
NewCounty = InputScanner.nextLine();
System.out.println("Please enter the customer's postcode: ");
NewPostcode = InputScanner.nextLine();
System.out.println("Please enter the number of adult party members: ");
NewNoOfAdults = InputScanner.nextInt();
System.out.println("Please enter the number of child party members: ");
NewNoOfChildren = InputScanner.nextInt();
System.out.println("Thank you for booking with Quantock Coaches.");
Trips.get(ChoosenTripID-1).AddBooking(NewFirstName, NewSurname, NewTelNumber, NewAddress1,
NewAddress2, NewCity, NewCounty, NewPostcode, NewNoOfAdults, NewNoOfChildren);
break;
}
case 3:
{
int CustomerID = 0, ChoosenBooking = 0;
ViewScanner = new Scanner(System.in);
System.out.println("Please select the trip by entering the ID numbers E.G. 12");
for (int i = 0; i < Trips.size();i++)
System.out.println(Trips.get(i).toString());
ChoosenTripID = ViewScanner.nextInt();
System.out.println("The choosen trip is: " + ChoosenTripID);
System.out.println(Trips.get(ChoosenTripID-1).ViewBooking());
System.out.println("Please select the ID number of the record you wish to remove.");
CustomerID = ViewScanner.nextInt();
System.out.println("Are you sure this is the booking you wish to delete? "
+ "Enter 1 for yes or 2 for no.");
ChoosenBooking = ViewScanner.nextInt();
switch (ChoosenBooking){
case 1:
{
Trips = null;
}
case 2:
{
System.out.println("Returning to main menu... Please wait.");
}
break;
}
}
case 4:
{
System.exit(0);
}
}
}
}
}