Advertisement
Guest User

CustomerProfile

a guest
Apr 26th, 2015
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. package edu.occ.or.cis2151;
  2.  
  3. import java.awt.GridLayout;
  4. import javax.swing.BorderFactory;
  5. import javax.swing.JCheckBox;
  6. import javax.swing.JTextField;
  7. import javax.swing.JPanel;
  8.  
  9. public class CustomerProfile extends JPanel {
  10.  
  11. private final double DISCOUNT = 0.90;
  12. private JCheckBox discount; // To select 10% Customer discount
  13. private JTextField customerName;
  14.  
  15. public CustomerProfile() {
  16.  
  17. setLayout(new GridLayout(4, 1));
  18. customerName = new JTextField("Name", 20);
  19. discount = new JCheckBox("Rewards Member Discount");
  20. setBorder(BorderFactory.createTitledBorder("Customer Info"));
  21.  
  22. add(discount);
  23. }
  24. public double getDiscount() {
  25. double discountCost = 0.0;
  26.  
  27. if (discount.isSelected())
  28. discountCost += DISCOUNT;
  29.  
  30. return discountCost;
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement