Customernumber public boolean getrecievemail return

This preview shows page 3 - 5 out of 5 pages.

return this.customerNumber; } public boolean getRecieveMail(){ return this.recieveMail; } //Mutators public void setCustomerNumber(String c){ this.customerNumber = c; } public void setRecieveMail(boolean r){ this.recieveMail = r; } } class PreferredCustomer extends Customer{ private int amtPurchased; private int discountLevel = 0; public PreferredCustomer(String name, String address, String number, String customerN, boolean rm,
int amtPurchased){ super(name, address, number, customerN, rm); this.amtPurchased = amtPurchased; if(amtPurchased >= 500 && amtPurchased < 1000){ this.discountLevel = 5; }else if(amtPurchased >= 1000 && amtPurchased < 1500){ this.discountLevel = 6; }else if(amtPurchased >= 1500 && amtPurchased < 2000){ this.discountLevel = 7; }else if(amtPurchased >= 2000){ this.discountLevel = 10; } } //Accessors public int getAmtPurchased(){ return this.amtPurchased; } public int getDiscountLevel(){ return this.discountLevel; } //Mutators public void setAmtPurchase(int amount){ this.amtPurchased = amount; } public void setDiscountLevel(){ if(amtPurchased >= 500 && amtPurchased < 1000){ this.discountLevel = 5; }else if(amtPurchased >= 1000 && amtPurchased < 1500){ this.discountLevel = 6; }else if(amtPurchased >= 1500 && amtPurchased < 2000){ this.discountLevel = 7; }else if(amtPurchased >= 2000){ this.discountLevel = 10; } } } class Driver {
public static void main(String args[]){ Scanner scanner = new Scanner(System.in); System.out.print("Enter name of customer:"); String name1 = scanner.nextLine(); System.out.print("Enter address of customer:"); String address1 = scanner.nextLine();

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture