Hi I found some examples of coursework, and Im trying to use them to learn better OO programming
the excerpt of specs :
* Mountain Bike (�20) � which can be booked with an optional helmet (�5). These come with a ladies or gents frame in sizes small/ medium/ large.
* Racing bike (�25) � this can be booked with an optional helmet and panniers (�10). These come with a ladies or gents frame in sizes small/ medium/ large.
* Children�s bike (�15) � this includes a cycle helmet which must be worn. These come in ages 4 to 14.
what I did, I created basic class Bike which implements Rentable,
Now I have question about Mountain Bike and Racing one,
Is it better to create one class for example
AdultBike extends Bike {
FrameType frameType;
FrameSize frameSize;
List<Options> options;
public AdultBike(String name, int price, ... ) {
super(name, price);
}
}
because those 2 types differ in numbers of options
or 2.way create MountainBike extends Bike, and then RacingBike extends MountainBike. but it doesnt sound good, because in real world racing bike doest come from mountain bike.
Thank you for your help!