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
What line of code makes the character pointer studentPointer point to the character variable userStudent?char userStudent = 'S';
Zielflug [23.3K]

Answer:

char* studentPointer = &userStudent;

Explanation:

Pointers in C are variables used to point to the location of another variable. To declare pointer, the data type must be specified (same as the variable it is pointing to), followed by an asterisk and then the name of the pointer. The reference of the target variable is also assigned to the pointer to allow direct changes from the pointer variable.

3 0
3 years ago
Write two examples of hard copy output?​
amid [387]

if you are asking for hard copy output devices, then two examples would be

printers

plotters

if you are asking for types hard copy documents then two examples would be

letter

card

7 0
3 years ago
Write python code that does the following.
Mariulka [41]

Answer:

the answers are in front of you it is correct to follow the steps

¯\_(ツ)_/¯:

5 0
3 years ago
Write a statement that calls a function named IncreaseItemQty, passing the variable addStock. Assign mugInfo with the value retu
PolarNik [594]

Answer:

Explanation:

#include <stdio.h>

#include <string.h>

typedef struct ProductInfo_struct {

char itemName[30];

int itemQty;

} ProductInfo;

ProductInfo IncreaseItemQty (ProductInfo productToStock, int increaseValue) {

productToStock.itemQty = productToStock.itemQty + increaseValue;

return productToStock;

}

int main(void) {

ProductInfo mugInfo;

int addStock;

addStock = 10;

scanf("%s", mugInfo.itemName);

scanf("%d", &mugInfo.itemQty);

**** /* Your solution goes here */ ****

printf("Name: %s, stock: %d\n", mugInfo.itemName, mugInfo.itemQty);

return 0;

}

8 0
3 years ago
What type of address is the ip address 198.162.12.254/24?
grigory [225]
<span>The IP address 198.162.12.254/24 is a </span>Unicast address.
4 0
3 years ago
Other questions:
  • Need help with this C++ question
    5·1 answer
  • When working with data returned from a query wizard, refreshing a query occasionally produces undesired results. if this occurs,
    9·1 answer
  • Spreadsheet software creates a ____, composed of a grid of columns and rows
    6·1 answer
  • When would an absolute cell reference be most helpful?
    12·2 answers
  • Addition and subtraction are considered to be ____ operations performed by a computer.
    7·1 answer
  • ____ is (are) the abuse of e-mail systems to send unsolicited e-mail to large numbers of people.
    14·1 answer
  • Which hexadecimal number is equivalent to the decimal number 11?
    13·1 answer
  • You need to buy a cable to connect a desktop PC to a router. Which cable should
    13·1 answer
  • The contribution of Charles Babbage in the history of computer​
    6·1 answer
  • Which three IP addresses may be pinged by the Test Management Network feature in the ESXi hosts DCUI
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!