Visual Basic Skateboard Designer The Skate Shop sells the following skateboard p
ID: 3777602 • Letter: V
Question
Visual Basic
Skateboard Designer
The Skate Shop sells the following skateboard products.
Decks: The Master Thrasher $60 The Dictator of Grind $45 The Street King $50
Truck assemblies: 7.75 axle $35 8 axle $40 8.5 axle $45
Wheel sets: 51 mm $20 55 mm $22 58 mm $24 61 mm $28
Additionally, the Skate Shop sells the following miscellaneous products and services:
Grip tape $10
Bearings $30
Riser pads $2
Nuts & bolts kit $3
Assembly $10
Create an application that allows the user to select one deck from a form, one truck assembly from a form, and one wheel set from a form. The application should also have a form that allows the user to select any miscellaneous product, using check boxes. The application should display the subtotal, the amount of sales tax (at 6%), and the total of the order. Do not apply sales tax to assembly.
Explanation / Answer
import javax.swing.*;
import java.awt.*;
/**
The AssembliesPanel category permits the user to pick out
the axles for the skateboard
*/
public category AssembliesPanel extends JPanel
the subsequent constants square measure accustomed indicate
// the price of the assemblies.
public final double AXLE1 = thirty five.00;
public final double AXLE2 = forty.00;
public final double AXLE3 = forty five.00;
personal JCheckBox axle1; // to pick out axle1
personal JCheckBox axle2; // to pick out axle2
personal JCheckBox axle3; // to pick out axle3
/**
Constructor
*/
public AssembliesPanel()
produce a GridLayout manager with
// four rows and one column.
setLayout(new GridLayout(3, 1));
// produce the check boxes.
axle1 = new JCheckBox("7.75 in. axle");
axle2 = new JCheckBox("8 in. axle");
axle3 = new JCheckBox("8.5 in. axle");
// Add a border round the panel.
setBorder(BorderFactory.createTitledBorder("Truck Assemblies"));
// Add the check boxes to the panel.
add(axle1);
add(axle2);
add(axle3);
}
}
import javax.swing.*;
02
import java.awt.*;
03
04
/**
05
The WheelsPanel category permits the user to pick out totally different wheels.
06
*/
07
08
public category WheelsPanel extends JPanel
09
the subsequent constants square measure accustomed indicate
11
// the price of wheels.
12
public final double WHEEL1 = twenty.0;
13
public final double WHEEL2 = twenty two.00;
14
public final double WHEEL3 = twenty four.00;
15
public final double WHEEL4 = twenty eight.00;
16
17
personal JRadioButton wheel1; // to pick out wheel1.
18
personal JRadioButton wheel2; // to pick out wheel2.
19
personal JRadioButton wheel3; // to pick out wheel3.
20
personal JRadioButton wheel4; // to pick out wheel4.
21
personal ButtonGroup bg; // Radio button cluster
22
23
/**
24
builder
25
*/
26
27
public WheelsPanel()
28
{
29
// produce a GridLayout manager with
30
// four rows and one column.
31
setLayout(new GridLayout(4, 1));
32
33
// produce the radio buttons.
34
wheel1 = new JRadioButton("51 mm", true);
35
wheel2 = new JRadioButton("55 mm");
36
wheel3 = new JRadioButton("58 mm");
37
wheel4 = new JRadioButton("61 mm");
38
39
// cluster the redio buttons
40
bg = new ButtonGroup();
41
bg.add(wheel1);
42
bg.add(wheel2);
43
bg.add(wheel3);
44
bg.add(wheel4);
45
46
// Add a border round the panel.
47
setBorder(BorderFactory.createTitledBorder("Wheels"));
48
49
// Add the radio buttons to the panel.
50
add(wheel1);
51
add(wheel2);
52
add(wheel3);
53
add(wheel4);
54
}
55
56
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.