preview

Nt1310 Unit 3 Lab 1

Decent Essays

1 CS 480 Lab #4 Due 12/1/13 In this lab, you will build a GUI that allows a user to make a rental car reservation. The GUI should look similar to what is shown below. It need not be exactly the same, but try to have the “general “ look be the same: The UI works as follows: 1. The customer fills in the form (with the exception of the rental amount which is automatically calculated). 2. When the customer clicks the Submit button, the UI should extract the data from the UI, instantiate a Reservation object containing the data, compute the cost of the reservation and update the Rental Amount textfield, and store the newly created Reservation object in an ArrayList of Reservations 3. When the new Reservation object is created in step #2, it should …show more content…

Instead, create a class RentalCharges which will have symbolic constants for this data. If the prices change, none of the UI code will need to be changed. Only the RentalCharges class will need to be modified. Coding in this manner improves the maintainability of your code. It also reduces the likelihood of bugs being introduced when the prices change – because the price information will be stored in only one place (no need to change multiple pieces of code or look through lots of code to try to find where the prices have been hardcoded). Break your GUI into multiple JPanel classes. This allows you to instantiate one of your panels and add it to a JFrame to test it. Once you have all the panels working, you can combine them together to create a more complex UI. Start by creating a program that creates an empty window Next, write a class for one of your sub-panels. Then instantiate the sub-panel and add it to your JFrame for testing. Repeat this for your other sub-panels. At least one of your JPanels will need access to the array list of Reservations. Instantiate the ArrayList object in your main() function and pass it to any JPanels that require it (i.e., pass to

Get Access