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

Customer Reward Project – A retail store provides reward to its Retail Customers

ID: 3768501 • Letter: C

Question

Customer Reward Project – A retail store provides reward to its Retail Customers and Corporate Customers. Each customer earns reward on their monthly purchase. The following table displays how to calculate the reward amount

Customer type

Total monthly purchase

Reward amount

Retail Customers

Less than $75

Over $150

5% of the total monthly purchase

7.5% of the total monthly purchase

10% of the total monthly purchase

Corporate Customers

Less than $500

$500 and over

8% of the total monthly purchase

15% of the total monthly purchase

Design an abstract class named Customer to hold the following data

customerID – customer ID info – int

name – customer name – string

purchase – monthly purchase – decimal

In Customer class, create constructors, properties, ToString() method and one abstract method CalculateReward(). The abstract methodCalculateReward() must be overridden in its subclasses. This method returns reward amount and takes no argument. Here is the method heading. public abstract decimal CalculateReward();

Create two subclasses, RetailCustomer and CorporateCustomer.

For RetailCustomer, add the following data field

eMail – customer email address - String

For CorporateCustomer, add the following data field

webSite – company web site - String

In RetailCustomer and CorporateCustomer classes, you create constructors, property, and override CalculateReward() method to calculate its own reward amount, and override ToString() method to display specific customer info and reward amount.

Test both classes in your main program.

Customer type

Total monthly purchase

Reward amount

Retail Customers

Less than $75

Over $150

5% of the total monthly purchase

7.5% of the total monthly purchase

10% of the total monthly purchase

Corporate Customers

Less than $500

$500 and over

8% of the total monthly purchase

15% of the total monthly purchase

Explanation / Answer

abstract class Customer
{
   int cid;
   String name;

   double monthlyp;
  
   Customer(int x,String y,double z)  
   {
      
       cid=x;
       name=y;
       monthlyp=z;
   }
  
int getCustomerId()
       {
           return cid;
       }
String getName()
{
   return name;
}
double getMonthlyPurchase()
{
   return monthlyp;
}  

public String toString()
{
  
   return "";
}
  
  


public abstract double CalculateReward();
}


class RetailCustomer extends Customer
{
  
  
   String eMail;
   public RetailCustomer(int x,String y,double z,String e)
   {
       super(x, y, z);
      
       eMail=e;
   }
   String getEmail()  
   {
       return eMail;
   }
      
   public double CalculateReward()
   {
       double rewardAmount;
   if(this.monthlyp<75)
   {
      
       rewardAmount=5*monthlyp/100;
      
   }
   if(this.monthlyp>=75 && this.monthlyp>=150)
   {
      
       rewardAmount=7.5*monthlyp/100;
      
   }
   else
       rewardAmount=10*monthlyp/100;

   return rewardAmount;
      
      
      
   }
  
   public String toString()
   {
      
      
return ("The Customer with Customer ID "+cid+ " and name "+name+" with total monthly purchase "+monthlyp+" with email Address "+eMail+" has reward amount="+CalculateReward()+"$");
   }
  
}

class CorporateCustomer extends Customer
{
  
  
   String webSite ;
   public CorporateCustomer(int x,String y,double z,String e)
   {
       super(x, y, z);
      
       webSite=e;
   }
   String getwebSite ()  
   {
       return webSite;
   }
      
   public double CalculateReward()
   {
       double rewardAmount;
   if(this.monthlyp<500)
   {
      
       rewardAmount=8*monthlyp/100;
      
   }
  
   else
       rewardAmount=15*monthlyp/100;

  
   return rewardAmount;  
      
      
   }
  
   public String toString()
   {
      
      
       return ("The Customer with Customer ID "+cid+ " and name "+name+" with total monthly purchase "+monthlyp+" with website "+webSite+" has reward amount="+CalculateReward()+"$");
   }
  
  
  
}

public class RewardPoint
{
  

    public static void main(String[] args)
    {

       RetailCustomer r=new RetailCustomer(1,"sagar",100,"sa@gmail");
       System.out.println(r.toString());
      
       CorporateCustomer c=new CorporateCustomer(2,"singla",1000,"singla@gmail");
       System.out.println(c.toString());
      
    }
}

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