Need coding in C# Thanks Customer Reward Project – A retail store provides rewar
ID: 3768605 • Letter: N
Question
Need coding in C# Thanks
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Chegg
{
public abstract class Customer{
protected int customerID;
protected string name;
protected double monthlyPurchase;
public Customer() { }
public Customer(int Id, string name, double monthlyPurchase)
{
customerID = Id;
this.name = name;
this.monthlyPurchase = monthlyPurchase;
}
public string ToString()
{
return name + " has made monthly purchase of " + monthlyPurchase;
}
protected abstract decimal CalculateReward();
}
class RetailCustomer : Customer
{
string email;
override double CalculateReward()
{
if (monthlyPurchase < 75)
return monthlyPurchase * 0.05;
else if (monthlyPurchase < 150)
return monthlyPurchase * 0.075;
else
return monthlyPurchase * 0.10;
}
}
class CorporateCustomer : Customer
{
string webSite;
override double CalculateReward()
{
if (monthlyPurchase < 500)
return monthlyPurchase * 0.08;
else
return monthlyPurchase * 0.15;
}
}
class Program
{
static void Main(string[] args)
{
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.