Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-05-2008, 08:45 PM
Member
 
Join Date: May 2008
Posts: 3
rose is on a distinguished road
need help!
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
Registration number
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 it’s 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


Option A:
Prompts the user to enter the car hire details accordingly and store them in the vector.

Option B:
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.

Option C:
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)

Option D:
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.

Option E:
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.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-05-2008, 10:04 PM
Zosden's Avatar
Senior Member
 
Join Date: Apr 2008
Posts: 353
Zosden is on a distinguished road
WOW this looks very familiar. Linky
__________________
My IP address is 127.0.0.1
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 05-06-2008, 02:51 AM
Eku Eku is offline
Senior Member
 
Join Date: May 2008
Location: Makati, Philippines
Posts: 160
Eku is on a distinguished road
^_^ I think i also read that same assignment Yesterday. . . =P
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +3. The time now is 11:51 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org