Question: using System; / / Define the ISellable interface public interface ISellable { void SalesSpeech ( ) ; void MakeSale ( ) ; } / /

using System; // Define the ISellable interface public interface ISellable { void SalesSpeech(); void MakeSale(); }// Define the abstract class Salesperson public abstract class Salesperson {// Fields private string firstName; private string lastName; // Constructor public Salesperson(string firstName, string lastName){ this.firstName = firstName; this.lastName = lastName; }// Properties public string FirstName { get { return firstName; } set { firstName = value; }} public string LastName { get { return lastName; } set { lastName = value; }}// Method to get the full name public string GetName(){ return $"{FirstName}{LastName}"; }}// Define the RealEstateSalesperson class public class RealEstateSalesperson : Salesperson, ISellable {// Fields private int totalValueSold; private double totalCommissionEarned; private double commissionRate; // Constructor public RealEstateSalesperson(string firstName, string lastName, double commissionRate) : base(firstName, lastName){ this.commissionRate = commissionRate; }// Implement SalesSpeech method public void SalesSpeech(){ Console.WriteLine("I specialize in finding the perfect homes for my clients."); }// Implement MakeSale method public void MakeSale(){ Console.WriteLine("Enter the dollar value of the house sold: "); if (int.TryParse(Console.ReadLine(), out int saleValue)){ totalValueSold += saleValue; totalCommissionEarned += saleValue * commissionRate; Console.WriteLine($"Sale recorded for {GetName()}. Total value sold: {totalValueSold:C}, Total commission earned: {totalCommissionEarned:C}"); } else { Console.WriteLine("Invalid input for sale value."); }}}// Define the GirlScout class public class GirlScout : Salesperson, ISellable {// Fields private int totalBoxes; // Constructor public GirlScout(string firstName, string lastName) : base(firstName, lastName){ totalBoxes =0; }// Implement SalesSpeech method public void SalesSpeech(){ Console.WriteLine("Support your local Girl Scout troop by purchasing delicious cookies!"); }// Implement MakeSale method public void MakeSale(){ Console.WriteLine("Enter the number of boxes of cookies sold: "); if (int.TryParse(Console.ReadLine(), out int boxesSold)){ totalBoxes += boxesSold; Console.WriteLine($"Sale recorded for {GetName()}. Total boxes sold: {totalBoxes}"); } else { Console.WriteLine("Invalid input for boxes sold."); }}}// Main program class Program { static void Main(){// Instantiate RealEstateSalesperson RealEstateSalesperson realEstateAgent = new RealEstateSalesperson("John", "Doe", 0.05); // Demonstrate SalesSpeech and MakeSale realEstateAgent.SalesSpeech(); realEstateAgent.MakeSale(); realEstateAgent.MakeSale(); // Instantiate GirlScout GirlScout girlScout = new GirlScout("Emma", "Smith"); // Demonstrate SalesSpeech and MakeSale girlScout.SalesSpeech(); girlScout.MakeSale(); girlScout.MakeSale(); }}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!