Question
In C#, complete the following program: namespace JobDemo { class Job { protected double hours; protected double price; public const double RATE = 45.00; public
In C#, complete the following program:
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 }
// Properties: JobNumber, Customer, Description, Hours, Price
The class has five properties that include a job number (int), customer name(string), job description(string), estimated hours(double), and price(double) for the job.
Use auto-implemented properties for the job number, customer name, and job description, but not for the hours or price property.
Hours property has both a get a set accessor (using hours filed). In addition, the price field value is calculated as estimated hours times RATE ($45.00) whenever the hours value is set, price = hours * RATE.
Price property has a get accessor only. User is not allowed to set the 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")); }
public override bool Equals(Object e) { //An Equals() method that determines two Jobs are equal if they have the same job number
}
public override int GetHashCode() { //A GetHashCode() method that returns the job number }
}
}
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