Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Climate And Environmental Database Systems

Authors: Michael Lautenschlager ,Manfred Reinke

1st Edition

1461368332, 978-1461368335

More Books

Students also viewed these Databases questions

Question

f. Did they change their names? For what reasons?

Answered: 1 week ago