Jump to content

Almost finished with my assisgnment just need help with my driver class

- - - - -

  • Please log in to reply
No replies to this topic

#1
MoshMoakes

MoshMoakes

    Newbie

  • Members
  • Pip
  • 5 posts
so I have to use file i/o and command line arguments for my driver class but my professor never went over these and instead let the ta do it and the ta just glanced over it and now I have to use both for a driver program I have where the instructions are to :

write a driver class RentCars that allows the car rental company to manage its car rentals. The main method in this class should take two command-line arguments: the path of an input file, followed by the path of an output file. The input file contains the VINs and odometer readings of at most 15 rental cars owned by the company. The driver program should first instantiate a CarCollection object, and then read in the information of every rental car from the input file and add the car to the CarCollection object (the rental cars should be added in the same order that they appear in the input file). Next, it should run into a loop. At each iteration of the loop, it should prompt the user to enter one of the following five options:

* The first user option a allows the company staff to add a rental car to its collection. If the user specifies this option, then the program should prompt the user to enter the VIN and initial odometer reading of a new rental car and then insert the car to the collection by invoking the addCar() method of the CarCollection class.
* The second user option r allows a customer to rent a car from the company. If the user specifies this option, then the program should prompt the user to enter the VIN of the rental car s/he desires to rent and then rent that car by invoking the rentCar() method of the CarCollection class (note that another car may be selected instead if the desired car is unavailable for rent).
* The third user option d allows a car renter's driving distance to be recorded. If the user specifies this option, then the program should prompt the user to enter the VIN of the rental car being driven and the distance traveled in miles and then simulate the driving by invoking the driveCar() method of the CarCollection class.
* The fourth user option t allows a car renter to return a car to the company. If the user specifies this option, then the program should prompt the user to enter the VIN of the rental car s/he wants to return, invoke the returnCar() method of the CarCollection class, and finally print the dollar amount that s/he should pay for the rent.
* The fifth user option q terminates this program. If the user specifies this option, then the program should invoke the toString() method of the CarCollection class, write its return string to the output file, and then terminate. However, if there is at least one car that has been rented out but not yet returned, then nothing should be written to the output file and the program should continue to run.

as for doing the options I have those written except for the last one but I don't know how to do the first part if anyone can help I will be very thankful




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users