//Assignment 4 Andrew Wilkie

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.InputMismatchException;
import java.util.Scanner;
public class CarCreator {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner input = new Scanner(System.in);
		boolean quit = false;
		
		int menuItem;
		
		System.out.println("Welcome Honda car customizer");
		System.out.println("Please customize the vehicle to your liking");
		System.out.println("Enter the number associated with a feature you wish to add");
		System.out.println("1. Air conditioning");
		System.out.println("2. Power windows");
		System.out.println("3. Sunroof");
		System.out.println("4. GPS");
		System.out.println("5. Order vehicle");
		Car firstCar = new BaseCar();
		while (quit == false) { try{
            System.out.print("Choose menu item: ");
            menuItem = input.nextInt();
            switch (menuItem) {
            case 1:
                  System.out.println("You've chosen to add Air conditioning");
                 
                      firstCar = new AirConditioning(firstCar);
                  break;
            case 2:
                  System.out.println("You've chosen to add Power windows");
                  
                      firstCar = new PowerWindows(firstCar);
                  break;
            case 3:
                  System.out.println("You've chosen to add Sunroof");
                 
                      firstCar = new SunRoof(firstCar);
                 
                  break;
            case 4:
                  System.out.println("You've chosen to add GPS");
                  
                      firstCar = new Gps(firstCar);
                  break;
            case 5:
                  System.out.println("Constructing your order");
                  quit = true;
               
                  System.out.println("Features are: " + firstCar.getDescription());
                  System.out.print("Price is: " + firstCar.getCost());
                  System.out.println("$");
                  DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd ");
                  Calendar cal = Calendar.getInstance();
                  cal.add(Calendar.WEEK_OF_YEAR, 2);
                  System.out.println("Your vehicle will be ready for pick up in two weeks on: " + dateFormat.format(cal.getTime())); 
                  System.out.print("at your local dealer.");
                  
                  
                  
                  
                  
                  
                  break;
           
            default:
                  System.out.println("Invalid choice.");
            }} catch (InputMismatchException e){
            	
            	 String bad_input = input.next();
            	 System.out.println("Choose a valid option by entering 1 - 5.");
            	  continue;
            } 
		
		//} while (!quit); 
            
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	}}}

