This assignment aims to provide you with some experience in writing codes using Java programming language that covers the following topics:
GUI and Event Handling
Remember that: 1. All programs should be able to run on the labs computers. 2. You must put the following information on the header of each text and source file you will be submitting in this assignment: Students full name: Students ID: Modification Date: Purpose of this file (or program): 3. Assignments that are not able to be compiled will result in zero mark given to the assignment. 4. You must only use the Java features that have already been covered in the lectures |
TASKS:
For this assignment, you are required to write a Java application using GUI for a small company selling laptops. The application will be used by the staff selling the laptop. The user may choose the details of the laptop to be sold depending on the buyers request (the product with the chosen specification must be available). The application should allow the user to enter the details of the laptop to be sold, determine whether the product is available calculate the sales amount, keep information of the sales done, and display sales information.
The application should display a frame containing the following:
- The company name displayed on a JLabel
- The image of the laptop shown on a JLabel
- The laptop brand and model (e.g. HP ProBook 650, Dell Inspiron, Apple MacBook Pro) a JComboBox is used to display the options. Include an event handling for this component where the image should change according to the model chosen
- CPU (e.g. intel CORE i5) JComboBox
- RAM (4 GB/8 GB/16 GB) use JRadiobutton to provide this selection
- Screen Size (e.g. 15 inches, 14 inches) also represented by JRadiobutton
- Color a simple JTextFiled for the user to type
- Additional Items (e.g. Additional RAM, laptop bag, antivirus software) several JCheckBox where the user may choose more than one option
- Whether the laptop has a touchscreen or not a single JCheckBox
- A JButton to make payment implement an event handling method for this button. When the user click on this button it will display another JFrame to show the sales details and process the payment. (sample output shown below)
- A JButton to save the sale record implement an event handling for this button. When the user click, it should create a Laptop object based on the details set on the frame and store the object in an ArrayList.
- A JButton to show the overall sales implement an event handling method for this button to display all sales done so far on a message dialog box.
- A JButton to quit from the application implement an event handling for this button to allow the user to quit.
The payment frame for the make payment button should have the following components
- A JTextArea that summarizes the sales details
- Total Price an uneditable JTextField to display the overall charges
- Discount rate a JTextField where the user can type the discount rate and should be initialized to zero Price after discount an uneditable JTextField
- Payment a JTextField where the user can enter the amount paid
- Balance a JTextField to show the balance after payment is done
- A JButton to return back to the main frame implement an event handling method for this button that will close the payment frame.
Your application should declare a class called Laptop to keep the laptop details as stated above. Include also a field to store the calculated price. The total price should depend on the brand, model and other options chosen. You are required to use reasonable prices for each of the options to perform the calculation in your application.
The following shows example output. You may have a different layout if you wish but the components must be the same.
area
Reviews
There are no reviews yet.