Answer:
See explaination
Step-by-step explanation:
Job.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JobApp
{
public class Job
{
private int jobNumber;
private int estimatedHours;
private double price;
public Job(int jobNum, int estHrs)
{
jobNumber = jobNum;
estimatedHours = estHrs;
CalculatePrice();
}
public int JobNumber { get; set; }
public int EstimatedHours
{
get { return estimatedHours; }
set { estimatedHours = value; CalculatePrice(); }
}
private void CalculatePrice()
{
price = estimatedHours * 45;
}
public virtual double getPrice()
{
return price;
}
public override string ToString()
{
return GetType() + "\\" +
"Job No: " + jobNumber + "\\" +
"Est. Hrs.: " + estimatedHours + "\\" +
"Price: $" + price;
}
}
}
RushJob.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JobApp
{
public class RushJob : Job
{
private double additionalCharge;
public RushJob(int jobNum, int estHrs, double additionalCharge):base(jobNum, estHrs)
{
this.additionalCharge = additionalCharge;
}
public override double getPrice()
{
return this.additionalCharge + base.getPrice();
}
public override string ToString()
{
return
base.ToString() + "\\" +
"Additional Charge: $" + this.additionalCharge + "\\" +
"Total Price: $" + getPrice();
}
}
}
JobDemo.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JobApp
{
class JobDemo
{
static void Main(string[] args)
{
Job job = new Job(101, 10);
Console.WriteLine(job.ToString());
Job rushJob = new RushJob(102, 15, 5);
Console.WriteLine("\\"+rushJob.ToString());
Console.ReadKey();
}
}
}