Write a program IN C# named SalespersonDemo that instantiates objects using classes named RealEstateSalesperson and GirlScout. Demonstrate that each object can use a SalesSpeech() method appropriately. Also, use a MakeSale() method two or three times with each object, and display the final contents of each object’s data fields.
First, create an abstract class named Salesperson. Fields include firstName and lastName; the Salesperson constructor requires both these values. Include properties for the fields. Include a method called GetName 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 the following:
- TotalValueSold - The total value sold in dollars (an int initialized to 0)
- TotalCommissionEarned - Total commission earned (a double initialized to 0)
- CommissionRate - The commission rate (a double required as the last argument to the class constructor, after first name and last name).
The GirlScout class includes a field (TotalBoxes of type int) to hold the number of boxes of cookies sold, which is initialized to 0.
Include properties for every field for both of the above classes.
In order to prepend the $ to currency values, the program will need to use the CultureInfo.GetCultureInfo method. In order to do this, include the statement using System.Globalization; at the top of your program and format the output statements as follows: WriteLine("This is an example: {0}", value.ToString("C", CultureInfo.GetCultureInfo("en-US")));
Create an interface named ISellable 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.
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
- 3. Design a user-defined class called Course. Each course object will hold data about a course. The data includes courseID, courseName, credits and instructorName. Define the instance variables required of the appropriate type. Provide only get methods along with toString() and equals() methods. Design another user-defined class called Student. Each student object will hold data on name, GPA and courseList. Make sure to define courseList as an ArrayList holding references to Course objects Implement a constructor that will take values to initialize name, and gpa while courseList is initialized to an ArrayList() object. Provide the following get methods: getStudent ID ( ), getName(), getGPA (), get Gender(), and get CourseList() Note: the getCouresList() method will return a copy of the coureList arraylist with copies of course objects. Provide the following set methods: setName(), setGPA (), setGender() Another method: addCourse () that will take a Course object and add it to the…arrow_forwardNo written by hand solution Must be coded in Java.arrow_forwardWhat is the main difference between a struct and a class? (More than 1 answer can be chosen)arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education