Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a class called Plumber that inherits from the CommissionEmployee class in

ID: 3846493 • Letter: C

Question

Create a class called Plumber that inherits from the CommissionEmployee class in Figure 11.10 In your Plumber class, Earnings() should calculate the fee earned for a plumbing job. Gross sales represents the amount charged to a customer and commission rate represents the % that a particular plumber earns.   Earnings is the amount charged * commission rate.

Your class should contain a constructor that inherits from the CommissionEmployee class and initializes the instance variables. The Plumber class should add an instance variable for the name of the customer where the plumbing service occurred.   Create a property for it also.

1.Source code for the Plumber class and test class

2. Screen shot of the program running with reasonable test data

I Fig. 11.10: BasePlusCommissionEmployee.cs 2 BasePlus Commission Employee inherits from CommissionEmployee and has 3 access to CommissionEmployee's protected members 4 using System 6 public class BasePlusCommissionEmployee Commission Employee private decimal baseSalary base salary per week six-parameter derived-class constructor 10 with call to base class CommissionEmployee constructor I I public Base Plus Commi ssion Employee string first string last I 2 string ssn decimal sales decimal rate decimal salary 13 base first, last ssn, sales rate I 4 15 BaseSalary salary validate base salary via property 16 17 end six-parameter BasePlus CommissionEmployee constructor I 8 Fig. II., 10 l Base Plus Commission Employee inherits from CommissionEmployee and has access to CommissionEmployee's protected members. (Part I of 3.)

Explanation / Answer

a) Plumber Class: -

using System;
namespace CommissionEmployee
{
class CommissionEmployee
{

}
class Plumber : CommissionEmployee
{
private decimal baseSalary;
   public Plumber(string first, string last, string ssn, decimal sales, decimal rate, decimal salary):base(first, last, ssn, sales, rate)
   {
       BaseSalary = salary;
   }
   public decimal BaseSalary
   {
       get
       {
           return baseSalary;
       }
       set
       {
           if(value>=0)
           {
               baseSalary = value;
               else
                   throw new ArgumentOutOfRangeException("BaseSalary", value,"BaseSalary must be >=0")
           }
       }
   }
}
public override decimal Earnings()

{
   return baseSalary + (commissionRate * grossSales);
}
public override string ToString()

{
   return string.Format("{0}:{1} {2} {3}: {4} {5}: {6:C} {7}:{8:f2} {9} :{10:C}", "base-salaried-commission employee", firstName, lastName, "social security number", socialSecurityNumber, "gross Sales", grossSales, "commission rate", commissionRate, "base salary", baseSalary);
}
static void Main(string[] args)
{

}
}
}

b) Test Class:-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Test_Method
{
class Test
{
int number, earning;
public void validate()
{
Console.Write(" Enter the first plumber details . (Total Earning = 750): ");
number = int.Parse(Console.ReadLine());
}
public void Earning()
{
earning = (int)number / 750 * 100;
if (earning < 25)
{
Console.WriteLine("Sorry! Your earning is " + earning);
}
else if (earning > 35 && earning < 50)
{
Console.WriteLine("You received earning around " + earning);
}
else if (earning > 50 && earning < 60)
{
Console.WriteLine("Your Earning increased as " + earning);
}
else if (earning > 60 && earning < 75)
{
Console.WriteLine("You earned maximum " + earning);
}
else
{
Console.WriteLine("You are at Top Earners " + earning);
}
}
}

class Program
{
static void Main(string[] args)
{
  
Test chk = new Test();
chk.validate();
chk.Earning();
Console.ReadLine();
}
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote