Download presentation
Presentation is loading. Please wait.
Published byTeemu Kouki Modified over 6 years ago
1
Exercise Design a Design Class for: Vehicle (for a car dealership)
Attributes Primary Key (1) Instance attribute (4) Class Attribute (1) Method Constructor methods (2) Instance Method Accessor methods (1 get & 1 set) Processing method (1) Class Method (1)
2
Vehicle Solution (an example)
Instance-Level Attributes VIN: string Make: string Model: string Type: string Color: string Year: int MPGhwy: int MPGcity: int DateReceived: DateTime DateSold: DateTime PurchasePrice: double SellingPrice: double PriceSold: double Class-Level Attributes RegistrationFee: double DownPayment%: double MinimumMarkup: double Instance-Level Methods Constructors + CreateVehicle() : Vehicle + CreateVehicle(vin, make, model) : Vehicle Accessors + getMake(): string + setMake(make) ** needs accessors for each attribute Processing Methods + CalcAvgMPG(): double + CalcDaysOnLot(): int + CalcProfit(): double Class-Level method + FindBelowPrice(price): VehicleArray + FindAboveMPG(mpg): VehicleArray + DisplayOldVehicles(date): VehicleArray + FindMostRecentVehicle(): Vehicle
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.