Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Written in C# as a console application, code the following. Create a class called Baker that inherits from the CommissionEmployee class in Figure 11.10 In

Written in C# as a console application, code the following.

Create a class called Baker that inherits from the CommissionEmployee class in Figure 11.10

In your Baker class, Earnings() should calculate the fee earned for a baking job.

Gross sales represent the amount charged to a customer and commission rate represents the % that a particular baker earns.

Baker Earnings is calculated as the skill level base rate + amount charged * commission rate.

Skill level base rate is $500 for an experienced carpenter and $250 for an apprentice.

Your class should contain a constructor that inherits from the CommissionEmployee class and initializes the instance variables.

The Baker class should add an instance variable for the name of the customer where the baking service occurred. Also, add an instance variable to represent skill level. Create a property for them also.

Create a second class that prompts the user for the information for two carpenters, creates the 2 two baker objects, then displays every two carpenters.

One baker should be experienced and one should be an apprentice.

image text in transcribed

image text in transcribed

image text in transcribed

I // Fig. 11.10: BasePlusCommissionEmployee.s 2 // BasePlusCommissionEmployee inherits from CommissionEmployee and has 3 // access to CommissionEmployee's protected members. 4 using System 6 public class BasePlusCommissionEmployee CommissionEmployee 8 private decimal baseSalary; // base salary per week 0 // six-parameter derived-class constructor // with call to base class CommissionEmployee constructor 12 public BasePlusCommissionEmployee string first, string last, 13 14 15 16 17// end six-parameter BasePlusCommissionEmployee constructor 18 string ssn, decimal sales, decimal rate, decimal salary : base first, last, ssn, sales, rate BaseSalary-salary; // validate base salary via property Fig. .10 | BasePlusCommissionEmployee inherits from CommissionEmployee and has access to CommissionEmployee's protected members. (Part I of 3.) 20 21 /7property that gets and sets // BasePlusCommissionEmployee's base salary public decimal BaseSalary 23 24 25 26 27 28 29 30 3 I 32 get return baseSalary I/end get set if(value )s 0 ) baseSalary-value; else throw new ArgumentOutOfRangeException"BaseSalary", value, "BaseSalary must be 0" 34 35 36 end set end property BaseSalary Fig. 11.10 | BasePlusCommissionEmployee inherits from CommissionEmployee and has access to CommissionEmployee's protected members. (Part 2 of 3.) // calculate earnings public override decimal Earnings O 37 38 39 40 4I return baseSalary commissionRate grossSales; // end method Earnings // return string representation of BasePl usCommissionEmp loyee public override string ToStringO 45 46 return string.Format 48 49 50 51 52 53 / end class BasePl usCommissionEmployee "base-salaried commission employee", firstName, lastName, "social security number", socialSecurityNumber, "gross sales", grossSales, "commission rate", commissionRate, "base salary", baseSalary //end method ToString Fig. 11.10|BasePlusCommissionEmployee inherits from CommissionEmployee and has access to CommissionEmployee's protected members. (Part 3 of 3.)

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

Principles Of Multimedia Database Systems

Authors: V.S. Subrahmanian

1st Edition

1558604669, 978-1558604667

More Books

Students also viewed these Databases questions

Question

Consistently develop management talent.

Answered: 1 week ago

Question

Create a refreshed and common vision and values across Europe.

Answered: 1 week ago

Question

Provide the best employee relations environment.

Answered: 1 week ago