Ejemplo n.º 1
0
        public string SpaceAvailabilityToString(int reservationDuration)
        {
            string result = ID.ToString().PadRight(10) + Name.PadRight(27) + DailyRate.ToString("C").PadRight(20) + MaxOccupancy.ToString().PadRight(15) +
                            IsAccessible.ToString().PadRight(15) + (DailyRate * reservationDuration).ToString("C");

            return(result);
        }
Ejemplo n.º 2
0
        public string SpaceListToString()
        {
            string result = ID.ToString().PadRight(10) + Name.PadRight(27) + MonthNumberToName(OpenFrom).PadRight(10) + MonthNumberToName(OpenTo).PadRight(10) +
                            DailyRate.ToString("C").PadRight(15) + MaxOccupancy.ToString();

            return(result);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo 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()
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
 public override string ToString()
 {
     return(Id.ToString().PadRight(4) + Name.PadRight(25) + IsAccessible.ToString().PadRight(20) +
            OpenFrom.PadRight(10) + OpenTo.PadRight(10) +
            DailyRate.ToString("C").PadRight(15) + MaxOccupancy.ToString().PadRight(10));
 }