Directions You have been selected to develop a GUI application called a “Configu
ID: 3734998 • Letter: D
Question
Directions
You have been selected to develop a GUI application called a “Configurator”. The application allows the user to complete the configuration of a computer system and produce a sales price for the system based on the configuration selected. The application must meet the minimum operating requirements and specifications as provided below:
Operation
The user configures the components of a computer system by selecting items from combo boxes, radio buttons, and check boxes.
When the user clicks the Calculate button, the application calculates the prices of the system by adding the cost of each selected component to the base price of the system.
An option is provided to the user to clear all entries and begin over.
As the systems are configured on the “fly”, the program should update the costs automatically to show the user the impact of adding or changing the basic system (running totals)
When the user presses the “order” button, the program should display the current configuration in a dialog box of your choice. The dialog box should show the configuration the user is about to order with pricing and totals. The user must confirm the configuration before the order is processed. When the user confirms the order, the order is processed and the order displayed as processed.
When the user closes the frame or presses the Exit button, the application exits.
Specifications
You are free to use whatever layouts and panels you need to design the application. You can also create any classes you think might be helpful to solve and develop this application. In short, you’re the developer and may use all resources available to you. The only requirement is: you must use the Java programming language.
There are two base priced computers:Intel based priced system is $499 and includes the following configuration:
Intel® Celeron® processor G1610
Memory - 4GB Dual Channel DDR3 1600MHz - 1 DIMMs
125GB 7200RPM SATA 3.0Gb/s Hard Drive
CD-Rom Drive
Integrated Audio
Microsoft Windows 8.1 OS
2 Piece Powered Speaker Set
USB Wired Entry Keyboard
USB Optical Mouse
AMD based priced system is $599 and includes the following configuration:
AMD FX-2100 for Desktops
4GB memory
125GB Hard Drive
Integrated 3D Graphics
CD-Rom Drive
Integrated Audio
Microsoft Windows 8.1 OS
2 Piece Powered Speaker Set
USB Wired Entry Keyboard
USB Optical Mouse
For the Intel systems, the user can select from 4 processors.
G1620 2.70GHz
Add $50.00
G1630 2.80GHz
Add $90.00
G1820 2.70GHz
Add $105.00
G1830 2.80GHz
Add $130.00
For the AMD systems, the user can select from 4 processors.
FX-8350
Add $25.00
FX-9590
Add $90.00
FX-4100
Add $187.00
FX-4300
Add $280.00
For both based systems, the user can select from 4 memory configurations.
6GB
Add $28
8GB
Add $58
12GB
Add $108
16GB
Add $176
For both based systems, the user can select from 3 hard drive configurations.
250GB
Add $27
500GB
Add $50
1TB
Add $89
For both based systems, the user can select from 3 optical drive configurations.
DVD Drive
Add $17
Combo DVD/CDRW
Add $40
DVD and CDRW
Add $79
For both based systems, the user can select from 3 graphic enhancements:
NVIDA GeForce G310 512MB DDR3
Add $80
NVIDA GeForce GT620 1GB DDR3
Add $169
NVIDA GeForce GT640 1GB GDDR5
Add $490
Using option buttons, the user can select from the following 3 operating systems.
Windows 8.1 (Default)
None
Windows 8.1 Pro
Add $59
Linux
Subtract $89
Using check boxes, the user can select any of the following 4 applications packages.
Microsoft Office Home and Student 2013
Add $139
Microsoft Office Home & Business 2013
Add $219
Accounting package
Add $399
Graphics package
Add $499
Consider using separate classes to represent each of the system configuration options.
Required Enhancements
Include sales tax at the rate of 0.078 in the final price. The sales tax should display separately of total and subtotal costing.
Include combined shipping and handling rate of 0.025 based on the total cost in the total price. The shipping and handling should display separately of the total, subtotal and sales tax.
Use a minimum of two graphics. The graphics could be used as buttons.
G1620 2.70GHz
Add $50.00
G1630 2.80GHz
Add $90.00
G1820 2.70GHz
Add $105.00
G1830 2.80GHz
Add $130.00
Explanation / Answer
import javax.swing.*;
import java.awt.EventQueue;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
public class Configurator {
private JFrame frame;
private JTextField textField;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Configurator window = new Configurator();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public Configurator() {
initialize();
}
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 471);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
JLabel lblIntelSystem = new JLabel("Intel System");
lblIntelSystem.setBounds(10, 11, 77, 14);
frame.getContentPane().add(lblIntelSystem);
JLabel lblAmdSystem = new JLabel("AMD System");
lblAmdSystem.setBounds(211, 11, 77, 14);
frame.getContentPane().add(lblAmdSystem);
final JComboBox comboBox = new JComboBox();
comboBox.setBounds(10, 36, 114, 20);
frame.getContentPane().add(comboBox);
comboBox.addItem("Select Processor");
comboBox.addItem("G1620 2.70GHz");
comboBox.addItem("G1630 2.80GHz");
comboBox.addItem("G1820 2.70GHz");
comboBox.addItem("G1830 2.80GHz");
final JComboBox comboBox_1 = new JComboBox();
comboBox_1.setBounds(211, 36, 114, 20);
frame.getContentPane().add(comboBox_1);
comboBox_1.addItem("Select Processor");
comboBox_1.addItem("FX-8350");
comboBox_1.addItem("FX-9590");
comboBox_1.addItem("FX-4100");
comboBox_1.addItem("FX-4300");
JLabel lblMemory = new JLabel("Memory");
lblMemory.setBounds(10, 92, 46, 14);
frame.getContentPane().add(lblMemory);
final JComboBox comboBox_2 = new JComboBox();
comboBox_2.setBounds(10, 117, 114, 20);
frame.getContentPane().add(comboBox_2);
comboBox_2.addItem("Select RAM");
comboBox_2.addItem("6GB");
comboBox_2.addItem("8GB");
comboBox_2.addItem("12GB");
comboBox_2.addItem("16GB");
JLabel lblHardDrive = new JLabel("Hard Drive");
lblHardDrive.setBounds(211, 92, 64, 14);
frame.getContentPane().add(lblHardDrive);
final JComboBox comboBox_3 = new JComboBox();
comboBox_3.setBounds(211, 117, 114, 20);
frame.getContentPane().add(comboBox_3);
comboBox_3.addItem("Select Hard Disk");
comboBox_3.addItem("250GB");
comboBox_3.addItem("500GB");
comboBox_3.addItem("1TB");
JLabel lblOpticalDrive = new JLabel("Optical Drive");
lblOpticalDrive.setBounds(10, 168, 103, 14);
frame.getContentPane().add(lblOpticalDrive);
final JComboBox comboBox_4 = new JComboBox();
comboBox_4.setBounds(10, 193, 119, 20);
frame.getContentPane().add(comboBox_4);
comboBox_4.addItem("Select Optical Drive");
comboBox_4.addItem("DVD Drive");
comboBox_4.addItem("Combo DVD/CDRW");
comboBox_4.addItem("DVD and CDRW");
JLabel lblGraphics = new JLabel("Graphics");
lblGraphics.setBounds(206, 168, 46, 14);
frame.getContentPane().add(lblGraphics);
final JComboBox comboBox_5 = new JComboBox();
comboBox_5.setBounds(211, 193, 114, 20);
frame.getContentPane().add(comboBox_5);
comboBox_5.addItem("Select Graphics");
comboBox_5.addItem("NVIDA GeForce G310 512MB DDR3");
comboBox_5.addItem("NVIDA GeForce GT620 1GB DDR3");
comboBox_5.addItem("NVIDA GeForce GT640 1GB GDDR5");
final JRadioButton rdbtnWindowsdefault = new JRadioButton("Windows 8.1 (Default)");
rdbtnWindowsdefault.setBounds(15, 249, 140, 23);
frame.getContentPane().add(rdbtnWindowsdefault);
final JRadioButton rdbtnWindowsPro = new JRadioButton("Windows 8.1 Pro");
rdbtnWindowsPro.setBounds(15, 283, 109, 23);
frame.getContentPane().add(rdbtnWindowsPro);
final JRadioButton rdbtnLinux = new JRadioButton("Linux");
rdbtnLinux.setBounds(15, 317, 109, 23);
frame.getContentPane().add(rdbtnLinux);
final JCheckBox chckbxMicrosoftOfficeHome = new JCheckBox("Microsoft Office Home and Student 2013");
chckbxMicrosoftOfficeHome.setBounds(206, 249, 222, 23);
frame.getContentPane().add(chckbxMicrosoftOfficeHome);
final JCheckBox chckbxMicrosoftOfficeHome_1 = new JCheckBox("Microsoft Office Home & Business 2013");
chckbxMicrosoftOfficeHome_1.setBounds(206, 283, 222, 23);
frame.getContentPane().add(chckbxMicrosoftOfficeHome_1);
final JCheckBox chckbxAccountingPackage = new JCheckBox("Accounting package");
chckbxAccountingPackage.setBounds(206, 317, 124, 23);
frame.getContentPane().add(chckbxAccountingPackage);
final JCheckBox chckbxGraphicsPackage = new JCheckBox("Graphics package");
chckbxGraphicsPackage.setBounds(206, 343, 140, 23);
frame.getContentPane().add(chckbxGraphicsPackage);
JButton btnCalculate = new JButton("Calculate");
btnCalculate.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent arg0) {
int total=0;
if(comboBox.getSelectedIndex()==1)
{
total+=50;
}
if(comboBox.getSelectedIndex()==2)
{
total+=90;
}
if(comboBox.getSelectedIndex()==3)
{
total+=105;
}
if(comboBox.getSelectedIndex()==4)
{
total+=130;
}
if(comboBox_1.getSelectedIndex()==1)
{
total+=25;
}
if(comboBox_1.getSelectedIndex()==2)
{
total+=90;
}
if(comboBox_1.getSelectedIndex()==3)
{
total+=187;
}
if(comboBox_1.getSelectedIndex()==4)
{
total+=280;
}
if(comboBox_2.getSelectedIndex()==1)
{
total+=28;
}
if(comboBox_2.getSelectedIndex()==2)
{
total+=58;
}
if(comboBox_2.getSelectedIndex()==3)
{
total+=108;
}
if(comboBox_2.getSelectedIndex()==4)
{
total+=176;
}
if(comboBox_3.getSelectedIndex()==1)
{
total+=17;
}
if(comboBox_3.getSelectedIndex()==2)
{
total+=40;
}
if(comboBox_3.getSelectedIndex()==3)
{
total+=79;
}
if(comboBox_4.getSelectedIndex()==1)
{
total+=80;
}
if(comboBox_4.getSelectedIndex()==2)
{
total+=169;
}
if(comboBox_4.getSelectedIndex()==3)
{
total+=490;
}
if(rdbtnWindowsdefault.isSelected())
{
}
if(rdbtnWindowsPro.isSelected())
{
total+=59;
}
if(rdbtnLinux.isSelected())
{
total+=89;
}
if(chckbxMicrosoftOfficeHome_1.isSelected())
{
total+=219;
}
if(chckbxAccountingPackage.isSelected())
{
total+=399;
}
if(chckbxGraphicsPackage.isSelected())
{
total+=499;
}
if(chckbxMicrosoftOfficeHome.isSelected())
{
total+=139;
}
textField.setText(Integer.toString(total));
}
});
btnCalculate.setBounds(112, 398, 89, 23);
frame.getContentPane().add(btnCalculate);
JLabel lblTotalPrice = new JLabel("Total Price");
lblTotalPrice.setBounds(229, 402, 59, 14);
frame.getContentPane().add(lblTotalPrice);
textField = new JTextField();
textField.setBounds(298, 399, 86, 20);
frame.getContentPane().add(textField);
textField.setColumns(10);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.