65959/Problem1/Problem1/Problem1.csproj
Exe
netcoreapp2.2
65959/Problem1/Problem1/Program.cs
using System;
namespace Problem1
{
public abstract class Employee
{
private readonly string firstName;
private readonly string lastName;
private readonly string socialInsuranceNumber;
public Employee(string mFirstName, string mLastName, string mSociaInsuranceNumber)
{
firstName = mFirstName;
lastName = mLastName;
socialInsuranceNumber = mSociaInsuranceNumber;
}
public override string ToString()
{
string value = firstName + lastName + "\n" + "SIN:" + socialInsuranceNumber + "\n";
return value;
}
public abstract decimal getWeeklyEarnings();
}
public class SalariedEmployee : Employee
{
decimal weeklySalary;
public SalariedEmployee(decimal mWeeklySalary, string mFirstName, string mLastName, string mSociaInsuranceNumber) : base( mFirstName, mLastName,mSociaInsuranceNumber)
{
weeklySalary = mWeeklySalary;
}
public override string ToString()
{
return base.ToString() + "Weekly salary: $" + weeklySalary.ToString();
}
public override decimal getWeeklyEarnings()
{
return weeklySalary;
}
}
public class HourlyEmployee : Employee
{
decimal hourlyWage;
decimal hoursWorkedPerWeek;
public HourlyEmployee(decimal mHourlyWage, decimal mHoursWorkedPerWeek, string mFirstName, string mLastName, string mSociaInsuranceNumber)
: base(mFirstName, mLastName, mSociaInsuranceNumber)
{
hourlyWage = mHourlyWage;
hoursWorkedPerWeek = mHoursWorkedPerWeek;
}
public override string ToString()
{
return base.ToString() + "Hourly wages: " + hourlyWage.ToString() + "\n" + "Hours worked: " + hoursWorkedPerWeek.ToString();
}
public override decimal getWeeklyEarnings()
{
return hourlyWage * hoursWorkedPerWeek;
}
}
class Program
{
static void Main(string[] args)
{
var hourly = new HourlyEmployee(15, 20, "John", "Smith", "987654321");
var salaried = new SalariedEmployee(1000, "Jane", "Smith", "1234678");
string salariedString =...