Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

CITP 4350 Assignment 4 Design a class named Person with properties for holding a person’s name, address, and telephone number. Design a class named Customer, which is derived from the Person class....

1 answer below »
CITP 4350 Assignment 4
Design a class named Person with properties for holding a person’s name, address, and telephone number.
Design a class named Customer, which is derived from the Person class. The Customer class should have the variables and properties for the customer number, customer email, a spentAmount of the customer’s purchases, and a Boolean variable indicating whether the customer wishes to be on a mailing list. It also includes a function named calcAmount that calculates the spentAmount.
All retail store has a prefe
ed customer plan where customers can earn discounts on all their purchases. The amount of a customer’s discount is determined by the amount of the customer’s cumulative purchases in the store as follows:
· When a prefe
ed customer spends $500, he or she gets a 5% discount on all future purchases.
· When a prefe
ed customer spends $1000, he or she gets a 6% discount on all future purchases.
· When a prefe
ed customer spends $1500, he or she gets an 8% discount on all future purchases.
· When a prefe
ed customer spends $2000, he or she gets a 10% discount on all future purchases.
Design a class named Prefe
edCustomer, which is derived from the Customer class. The Prefe
edCustomer class should have a variable, discountLevel, with a read-only property. It alsoincludes a setDiscountLevel function that determine the discount level based on the purchases amount using switch statement and an ove
ide function, calcAmount, calculates the spentAmount with the cu
ent discount level.
Create a CustomerDemo class. In the main function, the program calls the getData function to read the data from the “CustomerInfo.txt” file and create a dynamic a
ay of Prefe
edCustomer object. Then, it prompts user to enter a customer number and displays a menu:
1. Display Customer Information: display the specific customer information
2. Update Spent Amount: update the total amount with the co
ect discount level
After update the spent Amount, the program writes the updated information back to file.

5
Anna Alaniz
123 10th st, McAllen, TX 78504
XXXXXXXXXX
A0000001
XXXXXXXXXX
2500
true
Bob Ho
456 15th st, McAllen, TX 78504
XXXXXXXXXX
A0000002
XXXXXXXXXX
2500
true
Hector Alcose
2004 44th st, McAllen, TX 78501
XXXXXXXXXX
A0000003
XXXXXXXXXX
495
false
Jorge Lee
123 10th st, McAllen, TX 78504
XXXXXXXXXX
A0000004
XXXXXXXXXX
1200
true
Pablo Gonzalez
777 2th st, McAllen, TX 78502
XXXXXXXXXX
A0000005
XXXXXXXXXX
1750
false
Answered Same Day Oct 03, 2021

Solution

Arun Shankar answered on Oct 05 2021
128 Votes
CustomerInfo.txt
5
Anna Alaniz
123 10th st, McAllen, TX 78504
956-456-7899
A0000001
[email protected]
2500
true
Bob Ho
456 15th st, McAllen, TX 78504
956-456-1000
A0000002
[email protected]
2500
true
Hector Alcose
2004 44th st, McAllen, TX 78501
956-456-5555
A0000003
[email protected]
495
false
Jorge Lee
123 10th st, McAllen, TX 78504
956-555-6666
A0000004
[email protected]
1200
true
Pablo Gonzalez
777 2th st, McAllen, TX 78502
956-100-2000
A0000005
[email protected]
1750
false
main.cs
using System;
class Person
{
public string name;
public string address;
public string phone;
public void displayPerson()
{
Console.WriteLine("Name\t\t: {0}", name);
Console.WriteLine("Address\t: {0}", address);
Console.WriteLine("Phone\t:{0}", phone);
}
}
class Customer: Person
{
public string customerNumber;
public string customerEmail;
public double spentAmount;
public bool InMailingList;
public double calcAmount()
{
spentAmount = 0;
return spentAmount;
}
public void displayCustomer()
{
Console.WriteLine("Customer No.\t:{0}", customerNumber);
Console.WriteLine("Email\t\t:{0}", customerEmail);
Console.WriteLine("Amount Spent\t:{0}", spentAmount);
Console.WriteLine("InMailingList\t:{0}", InMailingList);
}
}
class Prefe
edCustomer: Custome
{
public int discountLevel;
public Prefe
edCustomer(string a, string b, string c, string d, string e, double f, bool g)
{
name = a;
address = d;
phone = b;
customerNumber = e;
customerEmail = c;
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here