public List <string> GetAttributesList()
        {
            List <string> attributes = new List <string>();

            attributes.Add(rego);
            attributes.Add(Make);
            attributes.Add(Model);
            attributes.Add(Year.ToString());
            attributes.Add(VehClass);
            attributes.Add(Seats.ToString());
            attributes.Add(Transmission);
            attributes.Add(Fuel);
            if (gps == true)
            {
                attributes.Add("gps");
            }
            attributes.Add(SunRoof.ToString());
            if (SunRoof == true)
            {
                attributes.Add("sunroof");
            }
            attributes.Add(DailyRate.ToString());
            attributes.Add(Colour);

            return(attributes);
        }
Beispiel #2
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()
Beispiel #3
0
        public string ToCSVString()
        {
            string csvString = "";

            csvString = csvString + Registration + "," + Grade + "," + Make + "," + Model + "," + Year.ToString() + "," + NumSeats.ToString() + "," + Transmission + "," + Fuel + "," + GPS.ToString() + "," + SunRoof.ToString() + "," + DailyRate.ToString() + "," + Colour + "";
            return(csvString);
        }