Is this a good case to use enthusiasm? Or would it be better to use an array? The values here have not changed, maybe they say once a year.
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { public enum transmission { Manual, NonSynchronous, Automatic, SemiAutomatic, Continuously, Infinitely, Electric, Hydrostatic, Hydrodynamic, } public enum bodystyle { Convertable, Hatchback, Sports, Sedan } public enum carcolors { Red, Blue, Yellow, White, Black, Green } public enum fueltype { Biofuels, FossilFuels, Nuclear, Fission, Fusion } public class Car { public Car(String cName, double cMaxSpeed, String cTransmission, String cBodystyle, String cColors, String cFueltype) { carname = cName; transmission = cTransmission; bodystyle = cBodystyle; colors = cColors; fueltype = cFueltype; maxspeed = cMaxSpeed; } public string carname { get; set; } public string transmission { get; private set; } public string bodystyle { get; private set; } public string colors { get; private set; } public string fueltype { get; private set; } public void carInfo() { Console.WriteLine("------------------------------------"); Console.WriteLine("Car Name: " + this.carname); Console.WriteLine("Car Transmission: " + this.transmission ); Console.WriteLine("Car Bodystyle: " + this.bodystyle); Console.WriteLine("Car Colors: " + this.colors); Console.WriteLine("Car Fueltype: " + this.fueltype); Console.WriteLine("Car MaxSpeed: " + this.maxspeed); Console.WriteLine("------------------------------------"); } } public class Program { static void Main(string[] args) { Car nissan = new Car("Lamborgini", 255, Convert.ToString(transmission.Automatic), Convert.ToString(bodystyle.Sports), Convert.ToString(carcolors.Red), Convert.ToString(fueltype.Biofuels)); nissan.carInfo(); } } }
Aaron source share