1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Mariana [72]
3 years ago
11

Create a constructor that requires parameters for the job number and estimated hours only. Also, include a ToString() method tha

t overrides the Object class's ToString() method and returns a string that contains the class name (using GetType()) and the job's data field values. The Job class has a child class named RushJob that includes an auto-implemented property, ExtraCharge, which holds an additional charge for the job. For the RushJob class, you need to create a constructor that accepts the job number, estimated hours, and extra charge. Also, override the Object class's ToString() method and return a string that contains the class name and all data field values, as well as the total price (i.e., price + extra charge). Finally, create an application class named JobDemo that instantiates one Job object and one RushJob object. Then call ToString() method and display the info of each object on the screen.
Computers and Technology
1 answer:
Elodia [21]3 years ago
5 0

Answer:

See explaination

Explanation:

Job.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace JobApp

{

public class Job

{

private int jobNumber;

private int estimatedHours;

private double price;

public Job(int jobNum, int estHrs)

{

jobNumber = jobNum;

estimatedHours = estHrs;

CalculatePrice();

}

public int JobNumber { get; set; }

public int EstimatedHours

{

get { return estimatedHours; }

set { estimatedHours = value; CalculatePrice(); }

}

private void CalculatePrice()

{

price = estimatedHours * 45;

}

public virtual double getPrice()

{

return price;

}

public override string ToString()

{

return GetType() + "\n" +

"Job No: " + jobNumber + "\n" +

"Est. Hrs.: " + estimatedHours + "\n" +

"Price: $" + price;

}

}

}

RushJob.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace JobApp

{

public class RushJob : Job

{

private double additionalCharge;

public RushJob(int jobNum, int estHrs, double additionalCharge):base(jobNum, estHrs)

{

this.additionalCharge = additionalCharge;

}

public override double getPrice()

{

return this.additionalCharge + base.getPrice();

}

public override string ToString()

{

return

base.ToString() + "\n" +

"Additional Charge: $" + this.additionalCharge + "\n" +

"Total Price: $" + getPrice();

}

}

}

JobDemo.cs

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace JobApp

{

class JobDemo

{

static void Main(string[] args)

{

Job job = new Job(101, 10);

Console.WriteLine(job.ToString());

Job rushJob = new RushJob(102, 15, 5);

Console.WriteLine("\n"+rushJob.ToString());

Console.ReadKey();

}

}

}

You might be interested in
The ABC Manufacturing company has a completely automated application system. The system, however, resides on index files and doe
Leni [432]

Answer:

Please see the attached file for complete Answer.

Explanation:

Download pdf
6 0
3 years ago
Read 2 more answers
There’s No Difference In Security If You Use A Public PC Or Your Own Computer.
Andreas93 [3]
False because if you use public someone else could be using it as a a trap to get your information and with your own if you no how to use it well you will be safe


3 0
4 years ago
Donna often travels around the world. When she travels, she needs to access her emails from different locations. However, to kee
Tju [1.3M]

Answer:

Yahoo! mail

Explanation:

In the context, Dona travels most often around the world. While traveling, she has to access her emails from different location and at different times. But in order to keep her luggage light, she never carries the laptop with her. Therefore, Donna uses Yahoo! mail to access her emails.

Donna uses Yahoo mail because she can install the Yahoo! mail app in her phone or tablets which is small in size and of light weight. She is able to organize her Outlooks,  Google mails and  Yahoo accounts. In Yahoo! mail, Donna is also able to sign in with her any of the non yahoo accounts and it also provides free cloud storage space.

8 0
3 years ago
Read 2 more answers
Write a program that converts temperatures in the Celsius scale to temperatures in the Fahrenheit scale. Your program should ask
Aleks [24]

Answer:

#include <iostream>

using namespace std;

int main()

{

   float celsius;

  cout<<"Enter the temperature in Celsius: ";

  cin>>celsius;

 

  float Fahrenheit  = 1.8 * celsius + 32;

  cout<<"The temperature in Fahrenheit  is: "<<Fahrenheit<<endl;

}

Explanation:

first include the library iostream in the c++ programming.

Then, create the main function and declare the variable celsius.

cout is used to print the message on the screen.

cin is used to store the user enter value in the variable.

then, apply the formula for calculating the temperature in Fahrenheit

and store the result in the variable.

Finally, print the result.

6 0
4 years ago
5. Which of the code excerpts below correctly links to an element with the id "awesome”.
Pachacha [2.7K]

Answer:

I think its click me

Explanation:

click me

6 0
3 years ago
Read 2 more answers
Other questions:
  • Seasons Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month a
    14·1 answer
  • What does a computer user need to know about programming in order to play a video game?
    6·2 answers
  • 10^4+10-2=<br>10^4+10-2=
    12·2 answers
  • When is a handrail required for stairs
    12·2 answers
  • Write chracteristics of all 5 generation of computer​
    7·2 answers
  • Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles, 5
    15·1 answer
  • Derek is creating an animation for his class project. What is the first step Derek should follow while creating the animation?
    11·2 answers
  • Who does online school on FLVS???????????????????
    9·2 answers
  • A network administrator has asked robin, a network engineer, to use ospf (open shortest path first) along with rip (routing info
    11·1 answer
  • Weak passwords are a(n) ___________ threat
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!