Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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_2

Step: 3

blur-text-image_3

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

Repairing And Querying Databases Under Aggregate Constraints

Authors: Sergio Flesca ,Filippo Furfaro ,Francesco Parisi

2011th Edition

146141640X, 978-1461416401

More Books

Students also viewed these Databases questions