Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C# 1. Consider the following code for an Employee class and answer the questions that follow accordingly: class Employee { private double monthlySalary; public int

image text in transcribed
image text in transcribed C#
1. Consider the following code for an Employee class and answer the questions that follow accordingly: class Employee { private double monthlySalary; public int IdNum { get; set; } public string Name { get; set; } public double Monthlysalary { get; set; } public Employee(int id, string name, double salary) { id; Name - name; MonthlySalary - salary: } IdNum - public virtual double PayCheck (Employee employee) { MonthlySalary - monthlySalary; return monthlysalary; } public void Employee Info(Employee employee) { WriteLine("Employee (O} has an ID number of {1} and receives a monthly salary of {2}", Name, IdNum, MonthlySalary.ToString("C")); } } 1.1 How many members does the Employee class have? Mention them. 1.2 The header of the method PayCheck declares it as virtual. What does that mean? 1.3 Re-write the auto-implemented property MonthlySalary to impose a restriction on assigning only positive values for the salary. 1.4 Assume that CommissionEmployee is a child class of Employee. It inherits all the members of its parents and also have: an auto-implemented property called CommissionRate and another one called SalesAmount. Ac- cordingly, write a constructor for class Commission Employee. 1.5 Assume that the commissioned employee receives a monthly salary plus a commission that can be calculated as follows: Commission = Sales Amount * Commission Rate Commissioned Salary = Monthly Salary + Commission Accordingly, write a method in CommissonEmployee class that overrides the PayCheck method in the parent class to calculate the salary of commissioned employees. 1.6 Write two statements that create two objects, one for each class

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

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions