Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package edu.occ.or.cis2151;
- import java.awt.GridLayout;
- import javax.swing.BorderFactory;
- import javax.swing.JCheckBox;
- import javax.swing.JTextField;
- import javax.swing.JPanel;
- public class CustomerProfile extends JPanel {
- private final double DISCOUNT = 0.90;
- private JCheckBox discount; // To select 10% Customer discount
- private JTextField customerName;
- public CustomerProfile() {
- setLayout(new GridLayout(4, 1));
- customerName = new JTextField("Name", 20);
- discount = new JCheckBox("Rewards Member Discount");
- setBorder(BorderFactory.createTitledBorder("Customer Info"));
- add(discount);
- }
- public double getDiscount() {
- double discountCost = 0.0;
- if (discount.isSelected())
- discountCost += DISCOUNT;
- return discountCost;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement