Create an abstract class named Salesperson. Fields include first and last names;
ID: 3621468 • Letter: C
Question
Create an abstract class named Salesperson. Fields include first and last names; theSalesperson constructor requires both these values. Include properties for the fields.
Include a method that returns a string that holds the Salesperson’s full name—the first
and last names separated by a space. Then perform the following tasks:
» Create two child classes of Salesperson: RealEstateSalesperson and GirlScout.
The RealEstateSalesperson class contains fields for total value sold in dollars and
total commission earned (both of which are initialized to 0), and a commission rate
field required by the class constructor. The GirlScout class includes a field to hold
the number of boxes of cookies sold, which is initialized to 0. Include properties for
every field.
» Create an interface named ISell that contains two methods: SalesSpeech()and
MakeSale(). In each RealEstateSalesperson and GirlScout class, implement
SalesSpeech()to display an appropriate one- or two-sentence sales speech that
the objects of the class could use. In the RealEstateSalesperson class, implement
the MakeSale()method to accept an integer dollar value for a house, add the
value to the RealEstateSalesperson’s total value sold, and compute the total
commission earned. In the GirlScout class, implement the MakeSale()method
to accept an integer representing the number of boxes of cookies sold and add it to
the total field.
» Write a program that instantiates a RealEstateSalesperson object and a
GirlScout object. Demonstrate the SalesSpeech()method with each object,
then use the MakeSale()method two or three times with each object. Display the
final contents of each object’s data fields. Save the file as SalespersonDemo.cs.
Explanation / Answer
Dear, abstract class Salesperson { protected string firstName; protected string lastName; public Salesperson(string fname,string lname) { this.firstName=fname; this.lastName=lname; } public string Name { get { return firstName+" "+lastName; } } } //Child classes class RealEstateSalesPerson : Saleperson { protected double total=0; protected double commision=0; protected rate; public RealEstateSalesPerson (double r):RealEstateSalesPerson() { this.rate=r; } } Able to help you up to here Hope this will help you
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.