import javax.swing.JOptionPane;

public class Car_use
{
	public static void main (String [ ]args)
	{

	//create a generic car using the default constructor
		System.out.println ("\nCreating a car......");

		Car myCar = new Car ();

	//Set propeties using the set methods
		System.out.println ("/nTesting Set methods....");

		String s;


		JOptionPane.showMessageDialog(null,"Please, input the info about a car",
		                              "Input info", JOptionPane.INFORMATION_MESSAGE);


		s = JOptionPane.showInputDialog ("Enter make");
		myCar.setMake (s);

		s = JOptionPane.showInputDialog ("Enter model");
		myCar.setModel (s);

		s = JOptionPane.showInputDialog ("Enter color");
		myCar.setColor (s);

		s = JOptionPane.showInputDialog ("Enter year");
		myCar.setYear (Integer.parseInt(s));

	//create alias newCar
		Car newCar = myCar;
		newCar.setColor ("Red");

		System.out.println ("Color of my car " + myCar.getColor());
		System.out.println ("Color of new car " + newCar.getColor());
		/*
		myCar has only a hex address of .... in it, that points
		to the instance of myCar. Alias newCar copies a hex address,
		but it points to the very same instance of myCar.
		So, we can set new color using either myCar or newCar.
		*/

	//retrieve information about myCar

		String out = "make: " +myCar.getMake();
		out += "\nModel: " +myCar.getModel();
		out += "\nYear: " +myCar.getYear();
		out += "\nColor: "+myCar.getColor();

		JOptionPane.showMessageDialog(null, out, "Car Report", JOptionPane.WARNING_MESSAGE);

		System.out.println ( "/nTesting get methods....");
		System.out.println (myCar.getMake());
		System.out.println (myCar.getModel());
		System.out.println (myCar.getYear());
		System.out.println (myCar.getColor());
		System.out.println ( "/nTesting toString....");
		System.out.println ( myCar.toString());

	//Test drive myCar
		System.out.println ("\nTest Driving...");
		myCar.drive ("Forward");
		myCar.turn ("left");
		//myCar.park ("S1");



	//create another car, this time using the paramaeterized constructor

		System.out.println ("/nCreating another car....");
		Car yourCar = new Car("Frari", "Metro" , 2003, "red");

		//change the year of yourCar using setYear
		//Print the year of yourCar using getYear


		System.exit(0);
	}
}


