Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following code for an abstract SalesPerson class that implements an interface called ISellable and answer the questions that follow accordingly: 1.1 Create a

Consider the following code for an abstract SalesPerson class that implements an interface called ISellable and answer the questions that follow accordingly:

image text in transcribed

1.1 Create a child class of SalesPerson and call it RealEstateSalesPerson. It has three auto-implemented properties TotalValueSold, TotalCommissionEarned and CommissionRate. It also has a constructor that require passing the commission rate.

1.2 In RealEstateSalesPerson class, implement the inherited abstract methods SaleSpeech() and MakeSale(). SaleSpeech() displays a small message to start the sale while MakeSale() accepts an integer value for a house, add the value to the RealEstateSalesPersons total value sold, and compute the total commission earned. Hint: SaleSpeech() may display Hi, want to buy a house? Have a few minutes to chat?.

1.3 Assume another child class is create and called GirlScout as illustrated in the following figure.

image text in transcribed

Provide another implementation for SaleSpeech() and MakeSale(). SaleSpeech() displays another appropriate message while MakeSale() accepts an integer number of cookie boxes sold and subtracts it from NumberOfCookieBoxes. Hint: SaleSpeech() may display Hello, would you like to buy some cookies? Its for a good cause! 1.4 Mention the Object-Oriented Programming approaches that are implemented in the example above. 2

QUESTION 2. Following up to question 1, assume a complete implementation for the SalesPerson class, along with its child classes.

2.1 Create a GUI application that contains a Label that tells the user to select a sales person type, and a ComboBox, from which the user can choose either Real Estate Agent or Girl Scout. When the user makes a selection, the corresponding SaleSpeech() method should be executed. Add another Label to display the output when the user makes a selection. Write the corresponding code and provide a screenshot of your GUI. Hint: SelectedIndex property for the combobox can be used returns the index of the selected item, value starts from 0.

abstract class Salesperson : Isellable { public string FirstName { get; set; } public string LastName { get; set; } public SalesPerson(string firstName, string lastName) { FirstName = firstName; LastName lastName; } public string GetSalespersonName(Salesperson salesPerson) { string name = FirstName + " " + LastName; return name; } public abstract string SaleSpeech(); public abstract double MakeSale(int SalesAmount); } public interface Isellable { string SaleSpeech(); double MakeSale(int SalesAmount); } class Girlscout : Sales Person { public int NumberOfCookieBoxes { get; set; } public Girlscout(string firstName, string LastName, int numofCookieBoxes) : base(firstName, LastName) { NumberOfCookieBoxes = numofCookieBoxes; } } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning PostgreSQL

Authors: Salahaldin Juba, Achim Vannahme, Andrey Volkov

1st Edition

178398919X, 9781783989195

More Books

Students also viewed these Databases questions