Esempio n. 1
0
 public VehicleTest(int id, VehicleClass vc, string mk, string md, string eng, int wh, int dr, int vt)
 {
     Id               = id;
     VehicleClass     = vc;
     Image            = vc.ToString();
     VehicleClassType = vc.ToString();
     Make             = mk;
     Model            = md;
     Engine           = eng;
     Wheels           = wh;
     Doors            = dr;
     VehicleType      = vt;
     this.Name        = mk + " - " + md + " - " + eng;
     if (vt == (int)CarType.Sedan)
     {
         this.Name += " (Sedan)";
     }
     else if (vt == (int)CarType.HatchBack)
     {
         this.Name += " (Hatch)";
     }
     else if (vt == (int)BikeType.Road)
     {
         this.Name += " (Road Bike)";
     }
     else if (vt == (int)BikeType.OffRoad)
     {
         this.Name += " (Off-Road Bike)";
     }
 }
Esempio n. 2
0
        public List <string> GetAttributeList()
        {
            bool _GPS     = true;
            bool _sunRoof = true;
            //Create new list of vehicle attributes
            List <string> VehicleAttributes = new List <string>();

            string regoAttr         = _vehicleRego.ToString();
            string makeAttr         = _make.ToString();
            string modelAttr        = _model.ToString();
            string yearAttr         = _year.ToString();
            string vehicleClassAttr = _vehicleClass.ToString();
            string numSeatsAttr     = _numSeats.ToString() + "-Seater";
            string transmissionAttr = _transmissionType.ToString();
            string fuelAttr         = _fuelType.ToString();
            string gpsAttr          = "GPS";
            string sunroofAttr      = "Sunroof";
            string dailyRateAttr    = _dailyRate.ToString();
            string colourAttr       = _colour.ToString();

            //Add strings to list
            VehicleAttributes.Add(regoAttr);
            VehicleAttributes.Add(makeAttr);
            VehicleAttributes.Add(modelAttr);
            VehicleAttributes.Add(yearAttr);
            VehicleAttributes.Add(vehicleClassAttr);
            VehicleAttributes.Add(numSeatsAttr);
            VehicleAttributes.Add(transmissionAttr);
            VehicleAttributes.Add(fuelAttr);
            VehicleAttributes.Add(dailyRateAttr);
            VehicleAttributes.Add(colourAttr);

            //Only Add GPS and Sunroof if true
            if (_GPSat)
            {
                VehicleAttributes.Add(gpsAttr);
            }
            if (_sunRoofat)
            {
                VehicleAttributes.Add(sunroofAttr);
            }

            for (int i = 0; i < VehicleAttributes.Count; i++)
            {
                Console.WriteLine(VehicleAttributes[i]);
            }
            return(VehicleAttributes);
        }
Esempio n. 3
0
        public string ToCSVString()
        {
            paramters.Add(vehicleRego);
            paramters.Add(make);
            paramters.Add(model);
            paramters.Add(year.ToString());
            paramters.Add(vehicleClass.ToString());
            paramters.Add(numSeats.ToString());
            paramters.Add(transmission.ToString());
            paramters.Add(fuelType.ToString());
            paramters.Add(GPS.ToString());
            paramters.Add(sunRoof.ToString());
            paramters.Add(colour);
            paramters.Add(dailyRate.ToString());
            string CSV = String.Join(",", paramters);

            return(CSV);
        }
Esempio n. 4
0
        }        // end of previous method - ToString()

        // ---------------------------------------------------------------------

        /// <summary>
        /// This method should return a list of strings which represent each attribute. Values
        /// should be made to be unique, e.g.numSeats should not be written as ‘4’ but as ‘4-
        /// Seater’, sunroof should not be written as ‘True’ but as ‘sunroof’ or with no string
        /// added if there is no sunroof.Vehicle rego, class, make, model, year, transmission
        /// type, fuel type, daily rate, and colour can all be assumed to not overlap(i.e. if
        /// the make ‘Mazda’ exists, ‘Mazda’ will not exist in other attributes e.g.there is
        /// no model named ‘Mazda’. Similarly, if the colour ‘red’ exists, there is no ‘red’
        /// make.You do not need to maintain this restriction, only assume it is true.)
        /// </summary>
        public List <string> GetAttributeList()
        {
            List <string> attributes = new List <string>();

            attributes.Add(VehicleRego);
            attributes.Add(Make);
            attributes.Add(Model);
            attributes.Add(Year.ToString());
            attributes.Add(VehicleClass.ToString());
            attributes.Add(NumSeats + "-Seater");
            attributes.Add(TransmissionType.ToString());
            attributes.Add(EngineSize + "-Cylinder");
            attributes.Add(Turbo.ToString());
            attributes.Add(FuelType.ToString());
            attributes.Add(GPS.ToString());
            attributes.Add(SunRoof.ToString());
            attributes.Add(Colour);
            attributes.Add(DailyRate.ToString());

            return(attributes);
        }        // end of previous method - GetAttributeList()
Esempio n. 5
0
 public override string ToString()
 {
     return("\nEconomy Class Car Details:" +
            "\nVehicle Rego: " + vehicleRego.ToString() + "\nVehicle Class: " + vehicleClass.ToString()
            + "\nMake: " + make.ToString() + "\nModel: " + model.ToString() + "\nYear: " + year.ToString()
            + "\nNumber of seats: " + numSeats.ToString() + "\nTransmission Type: " + transmissionType.ToString()
            + "\nFuel Type: " + fuelType.ToString() + "\nGPS: " + gps.ToString() + "\nsunRoof: " + sunRoof.ToString()
            + "\nDaily Rate: " + dailyRate.ToString("C2") + "\nColour: " + colour.ToString() + "\n\n");
 }
Esempio n. 6
0
 //Converts a vehicle into a string, with each attribute separated by a "," so that the returned
 //string is in CSV format
 public string ToCSVString()
 {
     return(vehicleRego + "," + make + "," + model + "," + year.ToString() + "," + vehicleClass.ToString() +
            "," + numSeats + "," + transmission + "," + fuel + "," + GPS + "," + sunRoof + "," + colour + "," +
            dailyRate);
 }