Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need help inputting this into visial studio for mac. i have tried and still get errors. here is the question n then the answers in

need help inputting this into visial studio for mac. i have tried and still get errors. here is the question n then the answers in order. image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
wage Chapter 6: C# Inheritance and Agile Metrics 163 Programming Challenge 6.1 The Tiny Company has two types of employees: full time and part time. Both types have an employee ID and employee name. Full time employees have a salary, and part time employees have an hourly and hours worked A full time employee gets paid weekly by dividing the salary by 52 while a part time employee gets paid by the product of hourly wage and hours worked. Specifically, you will create an Employee class with the common elements (employee ID, employee name, ToString0 method). Then create a Fulltime employee class with salary field and the GetWeeklyPaid() method. Similarly, create a Parttime employee class with hourly wage and hours worked fields and the GetWeeklyPaid method. Add appropriate properties, constructors, and ToString0 methods. Each class should be in its own cs file. Finally, demonstrate the classes in the Main() method of the Program class with data made up for two full time employees and two part time employees in a List. Display the employee's payment data in a foreach loop. 6.7 Solutions to Programming Challenges Programming Challenge 6.1 { namespace Chapter 6Employee class Employee // fields private string employeeId; private string employeeName; // properties public string EmployeeId { get { return employeeId; } set { employeeId = value; } } public string EmployeeName { get { return employeeName; } w O S D G set ( employeeName = value; } 1 W constructor public Enployee(string employeeld, string employeeName) { this.employeeId = employeeId; this. employeeNane employeeName; 2 I/ ToString() method public override string ToString() Thc str - string.Format("ID: {) Name: (1}", EmployeeId, EmployeeName); return str; 2 The Full Time employee class namespace Chapter Employee class FullTime Employee: Employee { Il field private decimal annualSalary: W property public decimal AnnualSalary get { return annualSalary; } set { annualSalary - value; } } // constructor public FullTime Employee(string employeeld, string employeeName, decimal annualSalary) base(employeeId, employeeName) ( this.annualSalary - annual salary: } 1/ GetWeeklypaid() method public decimal Getweeklypaid) decimal payAmount; payAmount - AnnualSalary / 52; return payAmount; // ToString() method public override string ToString() string str; } str = base.ToString() + string.Format(" Pay amount : (0:0)", GetWeeklypaid)) return str; 6. C# Inheritance and Agile Metrics { PUDIAC The Part time employee class namespace Chapter 6Employee class Part Time Employee: Employee // fields private decinal hourlyhage; private decimal hours worked; 77 properties public decimal Hourlywage { get { return hourlywage; } set { hourlywage - value; } public decimal HoursWorked { get { return hour sworked; } set { hours worked value; } } 7/ constructor public PartTimeEmployee(string employeeld, string employeeName, decimal hourlyWage, decinal hours worked) :base(employeeId, employeeName) { this.hourlyWage - hourlyWage; this. hoursWorked hoursWorked; } // Get Weeklypaid method public decimal GetWeeklypaid decimal payAmount; payAmount = Hours worked Hourlywlage; return payAmount; 1/ToString() method public override string ToString() string str; str = base.ToString() + string.Format("Pay amount: (0:0)", Getweeklypaid(); return str; 1 Demo code in the Main method using System; using System.Collections.Generic; hamespace Chapter6Employee 190 Agile Software Development with C# { class Program { static void Main(string[] args) { // create a list for all employees List(); // create two full time employees Full Time Employee fel = new Full Time Employee("111", "Alice", 67888.com); Fulltime Employee fe2 = new Full Time Employee("222", "Bob", 67555.00m); // create two part time employees Part Time Employee pei = new Part Time Employee("333", "Chuck", 22.12m, 20m); Part Time Employee pe2 = new Part Time Employee("444", "Dan", 23.33m, 18.45m); // add employees to the List allEmployees.Add(fel); allEmployees.Add(fe2); allEmployees.Add(pe1); allEmployees.Add(pe2); // display data foreach(Employee emp in allEmployees) { Console.WriteLine(emp); } Console.ReadKey(); } }

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

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions

Question

How will the members be held accountable?

Answered: 1 week ago

Question

a. Do team members trust each other?

Answered: 1 week ago