i need a java code for this assignment..especially B and C..thanks
Car hiring system
Write a class for hire car details to display the following information:
Type of car:
Year of car
Number of days for hire
Cost of the car for the duration of hire.
The cost of the car hire may be calculated based on a basic rate of 40 per day. The rate for cars older than 5 years is 30 per day. So for example if the duration of hire is for 5 days for a 2006 car, then the cost of the hire would be 200. If there are more than 6 days in duration for the hire period then a reduction of 9 % is given on the total cost of the car hire, regardless of its year. (A maximum 10 days car hire are allowed)
The hire details will be obtained from the user and stored in a vector . You should also provide a means for savinbg the contents of this vector to a file and retrieving data from the file to the vector each time the program runs.
Write a test program which will provide the following menu system: All prioe carr hire transactions should be loaded into the vector from the file once the program commences.
A. Hire a car B. Delete a transaction C. Modify D. Display all E. Save F. Quit
Prompts the user to enter the car hire details accordingly and store them in the vector.
Prompts the user to enter the registration number of car and then display that transaction details as in the following example:
Type : Nissan Micra
Year : 2006
Registration : 06D 45678
No days hire : 4
Cost : 160.00
The user should then be asked if they wish to delete the transaction i.e.
Delete Car Hire Transaction Y / N
Only the characters Y or N should be accepted as inputs for this part of the Program. If the response is Y the ticket should be deleted. If it is N, the program should return to the main menu. If any other input except Y or N is entered at this point the user should be presented with an error message and the user asked to try again.
Hint: Use a procedure called goAgain( ) to return a validated Y / N and use it throughout the assignment.
Prompt the user to enter the registration number of car and then display that transaction detail. A message should ask the user if these are the correct details. A Y answer should result in the user having to enter all details for that ticket once again. (Y and N are the only possible entries for this part as in option B)
Displays all car hire transactions on screen as in the following report:
Nissan Micra : 2006 : 06D 46782 : 4 : 160.00
Toyota Yaris : 2005 : 05D 23123 : 2 : 80.00
Nissan Primera : 2007 : 07D 23123 : 3 : 120.00 etc
Press Return to Continue
Note : These details must remain on Screen until the user presses return. On depression of the Return Key, the user should return to the main menu.
Open a text file and save the contents of the vector to this file.
All menu options should be written in a separate procedure and functions passing any necessary information as parameters.
WOW this looks very familiar. Linky
^_^ I think i also read that same assignment Yesterday. . . =P