the following is my entire VehicleClass.cs file that I'm using.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AlfordScottFinalProgrammingProject
{
public class VehicleClass
{
// Abstract Class
public abstract class Vehicle
{
// Abstract Property
public int Year
{
get;
set;
}
// Abstract Method
public virtual void StartVehicle()
{
}
}
// Base Class
public class Automobile : Vehicle
{
// Fields
public int _year;
public string _make;
public string _model;
public string _color;
// Default Constructor
public Automobile()
{
}
// Constructor
public Automobile(int year, string make, string model, string color)
{
_year = year;
_make = make;
_model = model;
_color = color;
}
// Year Property
public new int Year
{
get { return _year; }
set { _year = value; }
}
// Make Property
public string Make
{
get { return _make; }
set { _make = value; }
}
// Model Property
public string Model
{
get { return _model; }
set { _model = value; }
}
// Color Property
public string Color
{
get { return _color; }
set { _color = value; }
}
// Override StartVehicle Method
public override void StartVehicle()
{
MessageBox.Show("Automobile Started.");
}
// Drive Method
public void Drive()
{
MessageBox.Show("Went for a nice drive in the Automobile.");
}
// Park Method
public void Park()
{
MessageBox.Show("Parked the Automobile in the driveway");
}
// Wash Method
public void Wash()
{
MessageBox.Show("Washed the Automobile. Looks Great!");
}
}
public class Car : Automobile
{
// Fields
private int _doors;
// Default Constructor
public Car()
{
}
// Constructor
public Car(int year, string make, string model, string color, int doors) : base (year, make, model, color)
{
_doors = 2;
}
// Year Property
public new int Year
{
get { return _year; }
set { _year = value; }
}
// Make Property
public new string Make
{
get { return _make; }
set { _make = value; }
}
// Model Property
public new string Model
{
get { return _model; }
set { _model = value; }
}
// Color Property
public new string Color
{
get { return _color; }
set { _color = value; }
}
// Doors Property
public int Doors
{
get { return _doors; }
set { _doors = value; }
}
// Override StartVehicle Method
public override void StartVehicle()
{
MessageBox.Show("Car Started. It's Quiet!");
}
// Drive Car Method
public new void Drive()
{
MessageBox.Show("Went for a nice drive in the Car.");
}
// Park Car Method
public new void Park()
{
MessageBox.Show("Parked the Car in the driveway");
}
// Wash Car Method
public new void Wash()
{
MessageBox.Show("Washed the Car. Looks Great!");
}
}
public class SportsCar : Car
{
// Fields
private int _doors;
// Constructor
public SportsCar(int year, string make, string model, string color, int doors) : base (year, make, model, color, doors)
{
_doors = 2;
}
// Year Property
public new int Year
{
get { return _year; }
set { _year = value; }
}
// Make Property
public new string Make
{
get { return _make; }
set { _make = value; }
}
// Model Property
public new string Model
{
get { return _model; }
set { _model = value; }
}
// Color Property
public new string Color
{
get { return _color; }
set { _color = value; }
}
// Doors Property
public new int Doors
{
get { return _doors; }
set { _doors = value; }
}
// Override StartVehicle Method
public override void StartVehicle()
{
MessageBox.Show("Sports Car Started. It's Loud!");
}
// Drive Sports Car Method
public new void Drive()
{
MessageBox.Show("Went for a nice drive in the Sports Car.");
}
// Park Sports Car Method
public new void Park()
{
MessageBox.Show("Parked the Sports Car in the driveway");
}
// Wash Sports Car Method
public new void Wash()
{
MessageBox.Show("Washed the Sports Car. Looks Great!");
}
}
public class Truck : Automobile
{
// Field
private int _doors;
private string _driveType;
// Constructor
public Truck(int year, string make, string model, string color, int doors, string driveType)
: base(year, make, model, color)
{
_driveType = "";
_doors = 2;
}
// Year Property
public new int Year
{
get { return _year; }
set { _year = value; }
}
// Make Property
public new string Make
{
get { return _make; }
set { _make = value; }
}
// Model Property
public new string Model
{
get { return _model; }
set { _model = value; }
}
// Color Property
public new string Color
{
get { return _color; }
set { _color = value; }
}
// Doors Property
public int Doors
{
get { return _doors; }
set { _doors = value; }
}
// Drive Type Property
public string Type
{
get { return _driveType; }
set { _driveType = value; }
}
// Override StartVehicle Method
public override void StartVehicle()
{
MessageBox.Show("Truck Started. It's Loud!");
}
// Drive Truck Method
public new void Drive()
{
MessageBox.Show("Went for a nice drive in the Truck.");
}
// Park Truck Method
public new void Park()
{
MessageBox.Show("Parked the Truck in the driveway");
}
// Wash Truck Method
public new void Wash()
{
MessageBox.Show("Washed the Truck. Looks Great!");
}
}
public class MiniVan : Automobile
{
// Fields
public int _doors;
public int _passengers;
// Constructor
public MiniVan(int year, string make, string model, string color, int passengers)
: base(year, make, model, color)
{
_doors = 3;
_passengers = 7;
}
// Year Property
public new int Year
{
get { return _year; }
set { _year = value; }
}
// Make Property
public new string Make
{
get { return _make; }
set { _make = value; }
}
// Model Property
public new string Model
{
get { return _model; }
set { _model = value; }
}
// Color Property
public new string Color
{
get { return _color; }
set { _color = value; }
}
// Doors Property
public int Doors
{
get { return _doors; }
set { _doors = value; }
}
// Passengers Property
public int Passengers
{
get { return _passengers; }
set { _passengers = value; }
}
// Override StartVehicle Method
public override void StartVehicle()
{
MessageBox.Show("Minivan Started. It's Quiet!");
}
// Drive Minivan Method
public new void Drive()
{
MessageBox.Show("Went for a nice drive in the Minivan.");
}
// Park Minivan Method
public new void Park()
{
MessageBox.Show("Parked the Minivan in the driveway");
}
// Wash Minivan Method
public new void Wash()
{
MessageBox.Show("Washed the Minivan. Looks Great!");
}
}
}
}

New Topic/Question
Reply



MultiQuote





|