« All Events
6 PM – Intro To Java
August 19, 2021 @ 6:00 pm - 7:00 pm
Homework
- Add code inside getVehicle(int numOfSeat)
- Use for loop to go through each Vehicles in the list.
- Print the vehicle whose vehicle.numOfSeat is >= numOfSeat
- Example 1
Please select a driver below:
Nicholas - 1.5 miles/minute
Brandon - 2.0 miles/minute
Amber - 1.0 miles/minute
Gamas - 2.0 miles/minute
Dylan - 3.0 miles/minute
Enter the name of the driver or 'exit' to quit: nicholas
Please enter the number of passenger: 6
Please select your vehicle
BMW - 7 seats
Enter your selection: bmw
- Example 2. In this example since the user enter 2 for number of passenger, there are more choices on the vehicle:
Please select a driver below:
Nicholas - 1.5 miles/minute
Brandon - 2.0 miles/minute
Amber - 1.0 miles/minute
Gamas - 2.0 miles/minute
Dylan - 3.0 miles/minute
Enter the name of the driver or 'exit' to quit: brandon
Please enter the number of passenger: 2
Please select your vehicle
BMW - 7 seats
Camry - 5 seats
Smart Car - 2 seats
Enter your selection: camry