Question: ***IN JAVA***** UML is required for this program. Partial credit will be given in the program if you comment your code and I can see
***IN JAVA*****
UML is required for this program.
Partial credit will be given in the program if you comment your code and I can see you had the right idea even if it is not working correctly. It is better to write comments for parts of the program you cannot figure out than to write nothing at all.
Read the directions for the program carefully before starting. Make sure and ask for clarification if the directions are unclear.
You're renting electric scooters.
Create a class called Scooter that has the following attributes:
- Scooter name
- Rental rate
- Number of days to rent
The class should have the following overloaded constructors:
- A constructor that takes the Scooters name, rate, and number of days.
- A default constructor that sets the Scooters name to blank, and the other values to zero.
Write Get and Set methods for each attribute: name, price, number
- Do not allow number of days and rate to be less than zero
Have a bill method that will return rate times number of days for the total price.
Given the following Scooter offerings:
| Scooters name | Price per day | # of days |
| Segway Ninebot | 25.99 | 5 |
| Xiaomi Mi | 20.49 | 2 |
| Gotrax GXL | 16.97 | 4 |
Create the program ScooterTest that will create three objects for each row of the above table: first object must use the constructor for 3 values, second object must use the default constructor and the third object can use either constructor
Use the set functions to fill in the information not set by the constructor(s), especially the number ordered.
Print the values in the objects in a nice column format along with the total price.
Hint: have another method to do all the printing and pass each Scooter object to that method -- makes the program easier to write.
Create your UML for the class Scooter first and put it in the comments at the top of your program (required). Don't forget your name at the top in comments also.
For the user's output use printf or DecimalFormat to format the fractional numbers (especially those with money)
Zip and submit your program via Canvas under Final Programming
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
