Class diagram solution - I need your advice
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   JAMES_WEST
Posted On:   Wednesday, January 21, 2004 08:36 AM

Draw class and object diagrams for vehicle rental service. A customer can rent any automobile including SUVs and trucks. The vehicle is rented for a certain number of days and with a finite number of miles. Identify the relevant objects, and corresponding classes. Include relevant attributes and operations. Thanks for your response, It made me work hard. Please check the following if you can add anything or point out something wrong: Class Vehicle Attributes: model, availability, mileage, license plate, rate Methods: +rent(), +return(), +new() Class Contract Attributes: account #, license #, VIN#, amount Methods: +new(), +cancel () +overdue() Class customer Attributes: Name   More>>

Draw class and object diagrams for vehicle rental service. A customer can rent any automobile including SUVs and trucks. The vehicle is rented for a certain number of days and with a finite number of miles. Identify the relevant objects, and corresponding classes. Include relevant attributes and operations.

Thanks for your response, It made me work hard. Please check the following if you can add anything or point out something wrong:

Class Vehicle
Attributes: model, availability, mileage, license plate, rate
Methods: +rent(), +return(), +new()

Class Contract
Attributes: account #, license #, VIN#, amount
Methods: +new(), +cancel () +overdue()

Class customer
Attributes: Name, address, phone, license#, account#
Methods: +new(), +delete() +pickup() +return()

Class Rental Agency
Attributes: account number, amount/rate, insurance, start date, end date, start mileage, end mileage
Methods: +add() +delete() +find() +invoice() +checkmileage() +checkavailability()

I was wondering if I could combine Rental Agency with Contract in one class? what's your opinion?

Relationship: Vehicle (1:N) Contract 0:1
Customer 1:1 contract 0:N
Customer 1:N Rental agency 1:1

Please correct me if I'm wrong on this and add anything which I may have skipped.
How do I go about the object diagram?

   <<Less

Re: Class diagram solution - I need your advice

Posted By:   Stephen_McConnell  
Posted On:   Thursday, January 22, 2004 05:53 AM

I know this is a class assignment, but I have no problems helping if you have specific questions, as you do.


No you don't want to combine the RentalAgency and the Contract into a single class. They are two separate entities with different functions and different lives of their own.


NOW, the rental agency could have as an association the Contract class (meaning there is a reference to the Contract Class in the Rental Agency class.


For a basic representation of you problem, I think you've got a good start.


As for the object diagram, doesn't your text book discuss that? What does it say?


Stephen McConnell


Oh BTW... you might want to format your post with HTML tags... or it runs together.

About | Sitemap | Contact