Java Array - Rental Car (Reservation) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Java Array - Rental Car (Reservation)

What would be the best flow of this problem with using array in Java? Please help me with this. I don't know what would be the flow of this.

17th Nov 2019, 1:41 PM
Keima Katsuragi
Keima Katsuragi - avatar
2 Answers
+ 1
Hope it gives you some idea if you have not done it yet, and ignore it if you have completed. https://code.sololearn.com/cYWw43Conzzc/?ref=app
19th Nov 2019, 2:33 AM
Avinesh
Avinesh - avatar
+ 1
Start by creating a class Car which contains the name, model, per hour price and check availability etc. Also create a parametrized constructor for the class. Then I would recommend you to create an array list and pass the class to it and create different cars or you can do it by creating objects for the class. Once you do the above then create a function which accepts the car name, price per hour and availability. This function would be used by the user to select their car for use. This came straight from my head. I think it gives you an overall picture to go about this problem. This need not be the exact way but you can make changes to achieve your results.
17th Nov 2019, 2:00 PM
Avinesh
Avinesh - avatar