Car Rental Project

Only available on StudyMode
  • Download(s) : 135
  • Published : April 6, 2013
Open Document
Text Preview
CC1007NI Further Programming
Coursework 2
Spring Semester 2011/2012

Assignment

This assignment will be marked out of 100 and carries 70% of the overall module weighting. (The first part of the coursework carried the remaining 30%.) Your .java files and report for this part must be uploaded and submitted by 5pm on Friday of Week 12. The assignment must be carried out individually so you must not obtain help from anyone other than the module teaching staff. You must not copy code from any source apart from the module core text and the module materials. Collusion, plagiarism (unreferenced copying) and other forms of cheating constitute Academic Misconduct, which can lead to failure of the module and suspension.

Aim

The aim of this assignment is to add a class to the project that you developed for the first part of the coursework to make a graphical user interface (GUI) for a system that stores details of cars in your car company. The class will contain a main method and will be tested using the command prompt. A learning aid about the command prompt is linked from the main index page of the Learning Materials. You will also need to write a report about your program.

Deliverables

Create a new class within the project called CarCompany. When you are ready to submit your solution, upload your CarCompany.java file, together with the Car.java, CarToRent.java and CarToSell.java files from the first part of the coursework (not any other files from the project) together with your report in Microsoft Word format. Your report should be no more than 1000 words in length.

Program (60 marks)

An example GUI is shown below:

[pic]

Your GUI should contain the same components but you are free to use a different layout if you feel that it improves the aesthetics, ease of use etc. The CarCompany class should store an array list (not an array) of type Car to hold the cars to rent and the cars to sell. There should be text fields for entering:

1) the description
2) the down payment
3) the daily rate
4) the price
5) the year of registration
6) the mileage
7) the customer name
8) the date of hire
9) the date of return
10) the number of days
11) the car number (its position in an array list of cars)

The GUI should have the following buttons:

1) Add Car To Rent

When this button is pressed, the input values of the description, down payment and daily rate are used to create a new object of type CarToRent, which is added to an array list of cars.

2) Add Car To Sell

When this button is pressed, the input values of the description, price, year of registration and mileage are used to create a new object of type CarToSell, which is added to the array list of cars.

3) Rent a Car

The car number ,customer name, date of hire, date of return and the number of days are entered into the GUI. When this button is pressed, the input value of the car number is checked. If a suitable value has been entered, it is used to get the appropriate car from the array list of cars. The method to rent out the car in the CarToRent class is then called.

Hint: aCar is cast as CarToRent

4) Return a car

The car number is entered into the GUI. When this button is pressed, the input value of the car number is checked. If a suitable value has been entered, it is used to get the appropriate car from the array list of cars . The method to return a car in the CarToRent class is then called.

Hint: aCar is cast as CarToRent

5) Sell a Car

The car number and the customer name are entered into the GUI. When this button is pressed, the input value of the car number is checked. If a suitable value has been entered, it is used to get the appropriate car from the array list of cars . The method to sell a car in the CarToSell class is then called.

Hint: aCar is cast as CarToSell

6) Display All

When this...
tracking img