Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A retail store has a preferred customer plan where customers can carn discuess o

ID: 3625171 • Letter: A

Question

A retail store has a preferred customer plan where customers can carn discuess on all their purchases, the amount of a customer's discount is determined by the amount of the customer's currulative purchases in the store as follows When a preferred customer spends $500, he or she gets a 5 percent discount be all futute purchases. When a preferred customer spends $1.000, he or she gets a 5 percent discount be all futute purchases. When a preferred customer spends $1.500, he or she gets a 5 percent discount be all future purchases. When a preferred customer spends $2.000 or more he or she gats a 5 percent discount be all future purchases. Design a class named proforredcustomer, which extends the customer class you cridet in programming challenge 7. the preferredcustomer class should feilds the amount of the customer 's purchases and the customer's discount level. Write

Explanation / Answer

please rate - thanks

I assume you have Programming Challenge 7, since you only ask for 8

public class PreferredCustomerTest
{
   public static void main(String[] args)
   { PreferredCustomer a=new PreferredCustomer("Big Bird","123 Sesame Street","123-4567","123",true,592.00);
     System.out.println("Name: "+a.getName());
     System.out.println("Address: "+a.getAddress());
     System.out.println("Phone: "+a.getPhone());
     System.out.println("Customer Number: "+a.getNumber());
     System.out.println("Mailing List: "+a.getList());
     System.out.printf("Purchases: $%.2f ",a.getPurchases());
     System.out.println("Discount: "+a.getDiscount()*100+"%");
   }
}

-------------------------------------------------

ublic class PreferredCustomer extends Customer
{ private double purchases;           
private double discount;   
    public PreferredCustomer()
    {super();
        purchases=0;
        discount=0;
    }
    public PreferredCustomer(String n,String a,String p,String c, boolean m, double amt)
    {super(n,a,p,c,m);
    setDiscount(amt);
    }
   public void setDiscount(double p)
   { purchases = p;
        if (purchases>=2000)
            discount=0.1;       
        else if(purchases>= 1500)
            discount=0.07;   
        else if(purchases>=1000)
            discount=0.06;
        else if(purchases>=500)
            discount=0.05;   
        else
            discount=0;       
   }
   public double getPurchases()
   {return purchases;
   }
   public double getDiscount()
   {return discount;
   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote