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 Salespersonstring 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 $FirstNameLastName; Define the RealEstateSalesperson class public class RealEstateSalesperson : Salesperson, ISellable Fields private int totalValueSold; private double totalCommissionEarned; private double commissionRate; Constructor public RealEstateSalespersonstring firstName, string lastName, double commissionRate : basefirstName lastName this.commissionRate commissionRate; Implement SalesSpeech method public void SalesSpeech Console.WriteLineI specialize in finding the perfect homes for my clients."; Implement MakeSale method public void MakeSale Console.WriteLineEnter the dollar value of the house sold: ; if intTryParseConsoleReadLine 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.WriteLineInvalid input for sale value."; Define the GirlScout class public class GirlScout : Salesperson, ISellable Fields private int totalBoxes; Constructor public GirlScoutstring firstName, string lastName : basefirstName lastName totalBoxes ; Implement SalesSpeech method public void SalesSpeech Console.WriteLineSupport your local Girl Scout troop by purchasing delicious cookies!"; Implement MakeSale method public void MakeSale Console.WriteLineEnter the number of boxes of cookies sold: ; if intTryParseConsoleReadLine out int boxesSold totalBoxes boxesSold; Console.WriteLine$"Sale recorded for GetName Total boxes sold: totalBoxes; else Console.WriteLineInvalid input for boxes sold."; Main program class Program static void Main Instantiate RealEstateSalesperson RealEstateSalesperson realEstateAgent new RealEstateSalespersonJohn "Doe", ; Demonstrate SalesSpeech and MakeSale realEstateAgent.SalesSpeech; realEstateAgent.MakeSale; realEstateAgent.MakeSale; Instantiate GirlScout GirlScout girlScout new GirlScoutEmma "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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
