Question: In C#, here is a given Job class: using System; namespace JobDemo { class Job { protected double hours; protected double price; public const double

In C#, here is a given Job class:

using System;

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) { //constructor that requires parameters for all the data except price this.JobNumber = num; this.Customer = cust; this.Description = desc; hours = hrs; price = hours * RATE; } // Properties: JobNumber, Customer, Description, Hours, Price //Auto-implemented property JobNumber public int JobNumber { get; set; }

//Auto-implemented property Customer public string Customer { get; set; }

//Auto-implemented property Description public string Description { get; set; }

//Property JobNumber public double Hours { get { return hours; } set { hours = value; //set price whenever hours is set price = hours * RATE; } }

//Property Price that has only get public double Price { get { return price; } }

//ToString method is provided: public override string ToString() { return (GetType() + " " + JobNumber + " " + Customer + " " + Description + " " + Hours + " hours @" + RATE.ToString("C") + " per hour. Total price is " + Price.ToString("C")); }

//override Equals method public override bool Equals(Object e) { //An Equals() method that determines two Jobs are equal if they have the same job number if (this.JobNumber == ((Job)e).JobNumber) return true; else return false; }

public override int GetHashCode() { //A GetHashCode() method that returns the job number return JobNumber; }

}

}

The following RushJob class derives from Job. Complete the missing parts.

namespace JobDemo { class RushJob : Job { public const double PREMIUM = 150.00;

// Constructor: public RushJob():base? Create a RashJob constructor that takes no parameters. You need to add the base class constructor to make the derived class constructor complete though.

//update Hour property with new price calculation: price = hours * RATE + PREMIUM;

public override string ToString() { //Update ToString() method that returns a string containing all job information and rush job premium.

} } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!