Question
There are 3 classes in total about a jobs in C#. Complete the missing parts of the RushJob class: 1) Job.cs namespace JobDemo { class
There are 3 classes in total about a jobs in C#. Complete the missing parts of the RushJob class:
1) Job.cs
namespace JobDemo { class Job { protected double hours; protected double price; public const double RATE = 45.00;
public Job(int num, string cust, string desc, double hrs) { this.JobNumber = num; this.Customer = cust; this.Description = desc; hours = hrs; price = hours * RATE; }
public int JobNumber { get; set; } public string Customer { get; set; }
public string Description { get; set; } public double Hours { get { return hours; } set { hours = value; price = hours * RATE; } } public double Price { get { return price; } }
public override string ToString() { return (GetType() + " " + JobNumber + " " + Customer + " " + Description + " " + Hours + " hours @" + RATE.ToString("C") + " per hour. Total price is " + Price.ToString("C")); }
public override bool Equals(Object e) { if (this.JobNumber == ((Job)e).JobNumber) return true; else return false; }
public override int GetHashCode() { return JobNumber; } } }
2) Program.cs
namespace JobDemo { class Program { static void Main(string[] args) {
Job[] jobs = new Job[3]; jobs[0] = new Job(111, "John", "Analyst", 12); jobs[1] = new Job(112, "Clary", "Programmer", 14.15); jobs[2] = new Job(113, "Jason", "Developer", 13.15);
Console.WriteLine(jobs[0].ToString()); Console.WriteLine(jobs[1].ToString()); Console.WriteLine(jobs[2].ToString());
if (jobs[0].Equals(jobs[1])) { Console.WriteLine(" Both the jobs are same."); } else if (jobs[0].Equals(jobs[2])) { Console.WriteLine(" Both the jobs are same."); } else if (jobs[1].Equals(jobs[2])) { Console.WriteLine(" Both the jobs are same."); } else { Console.WriteLine(" Both the jobs are not same."); } Console.WriteLine(" Press any key to continue..."); Console.ReadKey(); } } }
3) RushJob (to be completed)
namespace JobDemo { class RushJob : Job { public const double PREMIUM = 150.00;
//TODO: Constructor with no parameters: public RushJob()
//TODO: update Hour property with new price calculation: price = hours * RATE + PREMIUM;
public override string ToString() { //TODO:
} } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started