You are contracted to develop a software application to maintain business activities for a bike hire shop “Bike now“. The shop has bikes of different types, such as Road, Mountain, City, etc. Also, a new category of bikes appeared recently – electric bikes, or ebikes. If you are not familiar with ebikes look for information at https://www.explainthatstuff.com/electricbikes.html
As compared to ordinary bike, ebike has battery and motor.
- All bikes which shop owns must be recorded in the system.
- Price per day depends on bike type. Look at types of bikes and prices at https://www.bikenow.com.au/all-bikes-products
- The system also keeps list of all customers and all rental transactions.
- Each customer can rent only one bike at a time.
- Rent cannot have duration more than 30 days.
Your application must support such functions as
- Display all available bikes
- Add customer
- Search for a customer by customer id and display all customer details
- Add rent
- Display all rents
- Return bike
- Search rents by a date appropriate for your data and display all overdue rents
- Save rents in file
- Read rents from file and display rents
First, design your application using several classes and appropriate associations between classes. You can have such classes as Bike, EBike, Customer, and Rent.
Choose minimal number of variables (not one) for each class required for maintaining the functionality of the system.
EBike can be subclass of Bike and inherit such attributes as type, pricePerDay, and availability. It also can have its specific attribute String motor.
To simplify a search for a bike required to create a rent, consider such types of Bike as Mountain, Road, City, and eBike. Type “eBike”, must be assigned to instances of EBike class. EBike attribute motor will have two possible values: “Full power” and “Power assist”.
Another class BikeNow will manage the application. It can have ArrayList of bikes (superclass type Bike), ArrayList of customers, and ArrayList of rents.
This class must have methods to deal with this storage.
Interaction with a user must be implemented as menu with options listed as system functions. Each menu option will call one or two methods defined in the class. Some methods require search methods to call.
The most important is option 5: Add rent. It requires to create a method addRent().
The addRent() method will need to get input for customerId (think of best implementation though), a start date and duration in days. It also has to identify a bike for rent.
It can take a user input for a bike type. It must search list of bikes by type and use first available bike of this type to create a rent. Note if bike type is “ebike”, you must search instances of EBike class for type of motor: “Full power” or “Power assist”.
When a rent is created for a bike, bike’s availability is set to false.
This method must throw exception if duration is greater than 30 days.
The option 7: Return bike must call method returnBike(). This method removes rent for this bike from the array list of rents and sets bike’s availability to true.
In option 9 you must save rents into binary file using ObjectOutputStream.
In option 10 you must read rents from binary file using ObjectInputStream and store them in ArrayList rents. Display current state of ArrayList of rents after reading from file.
Create an initial list of bikes (at least 12 bikes in total, make at least three types of ordinary bikes, and make at least four ebikes of different types of motor).
Create an initial list of customers (at least 3 customers).
Create an initial list of rents (at least 2 rents, one for ordinary bike, and another for ebike).
Start your application with populating lists of bikes, customers, and rents.
It’s required for debugging and marking. 3 marks will be taken for empty initial lists.
Submit on Canvas all your files in a compressed folder named as <ass1_your_name.zip>
Base classes are created and compiled 15 marks
Options 1, 2, 3, 4 10 marks
Options 5, 6, 7 15 marks
Options 8, 9, 10 15 marks