Question
Complete the code in C#. Part 1 is one program. Part 2 is another program. They're seperate programs, but use part 1 to figure out part 2.

Part! Create a new console application named Demojobs. Write a program for Harolds Home Services. The program should instant
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here a new Console Application in C# is created using Visual Studio 2017 with name "DemoJobs".This application contains a class with name "Program.cs".Below are the details of this class.

Program.cs :

//namespace
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//application namespace
namespace DemoJobs
{
class Program //C# class
{
//entry point , Main() method
static void Main(string[] args)
{
//creating object of Job class
Job job1 = new Job();
job1.Description = "wash windows";//set description
job1.PerHourRate = 25.00;//set per hour rate
job1.TimeInHours = 3.5;//set time in hours
//display job1 details
Console.WriteLine("----------Job1 details-----------");
Console.WriteLine("Description: "+job1.Description+",Per Hours Rate: "+job1.PerHourRate+", Time in Hours:"+job1.TimeInHours);
Console.WriteLine("Total Fee : "+job1.totalFee);
//creating object of Job class
Job job2 = new Job();
job2.Description = "wash cloths";//set description
job2.PerHourRate = 30.00;//set per hour rate
job2.TimeInHours = 1.5;//set time in hours
//display job2 details
Console.WriteLine("----------Job2 details-----------");
Console.WriteLine("Description: " + job2.Description + ",Per Hours Rate: " + job2.PerHourRate + ", Time in Hours:" + job2.TimeInHours);
Console.WriteLine("Total Fee : " + job2.totalFee);
//creating another object of job class
Job job3 = new Job();
job3 = job1 + job2;//add two objects
//display job3 details
Console.WriteLine("----------Job3 details-----------");
Console.WriteLine("Description: " + job3.Description + ",Per Hours Rate: " + job3.PerHourRate + ", Time in Hours:" + job3.TimeInHours);
Console.WriteLine("Total Fee : " + (job1.totalFee+job2.totalFee));
Console.ReadKey();//to hold the screen

}
}
//C# class
class Job
{
//data fields
private string description;
private double timeInHours;
private double perHourRate;
public double totalFee;
//getter and setter methods
public string Description
{
get { return this.description; }
set { this.description = value; }
}
public double PerHourRate
{
get { return this.perHourRate; }
set { this.perHourRate = value;
this.totalFee = this.perHourRate * timeInHours;
}
}
public double TimeInHours
{
get { return this.timeInHours; }
set {
this.timeInHours = value;
this.totalFee = this.perHourRate * timeInHours;
}
}
//overloaded + operator
public static Job operator +(Job j1,Job j2)
{
Job j3 = new Job();//creating Job class object
//description of two jobs
j3.description = j1.description + " and " + j2.description;
//sum of time in hours
j3.timeInHours = j1.timeInHours + j2.timeInHours;
//average of per hour rate
j3.perHourRate = (j1.perHourRate + j2.perHourRate) / 2;
return j3;//return j3
}

}
}

======================================================

Output : Run application using F5 and will get the screen as shown below

Screen 1 :Program.cs

Add a comment
Know the answer?
Add Answer to:
Complete the code in C#. Part 1 is one program. Part 2 is another program. They're...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program to run the following methods in C#. 2) Write a method that takes...

    Write a program to run the following methods in C#. 2) Write a method that takes in a teacher’s last name and exam number via parameters. Ask the teacher (using her name) to tell you the highest score on that exam. Your question should look something like “Ms. Jones, what was the highest grade on test two?” Return the value of the highest grade to the calling method. 3) Write a function called MinOfThree that takes in three numbers and...

  • George saves 18% of his total gross weekly earnings from his 2 part-time jobs

    George saves 18% of his total gross weekly earnings from his 2 part-time jobs. He earns $6.25 per hour from one part-time job and $7.50 per hour from the other part-time job. George works a total of 40 hours between the two jobs each week. What additional information is needed to determine the amount of his earnings he saves each week?

  • This is the example given. (1) Higher Rate for Overtime Hours One could pay at the...

    This is the example given. (1) Higher Rate for Overtime Hours One could pay at the higher rate for the overtime hours. Formula Hours Amount Hours Worked, Job A: 30.0 30.0 hours x $14.75 $442.50 -266.70 Hours Worked, Job B: 14.0 14.0 hours x $19.05 ($19.058 x 0.5) $9.53, rounded Overtime hourly rate Overtime Hours: 4.0 $9.53 x 4.0 hours 38.12 $747.32 Gross Earnings a-the higher of the two Give It A Try Note: Round interim calculations to two decimal...

  • Darren is searching for a new job in Brisbane. He pays a $150 fee to join...

    Darren is searching for a new job in Brisbane. He pays a $150 fee to join a job website called "Jobs in Brisbane" where he will conduct his search. He is currently employed and is paid $50,000 annually but would like a job that pays more. Darren values his free time the same as his hourly rate which is $30/hour. Which of the following statements is true? Darren should search until he knows all the available jobs in Brisbane. The...

  • In cases where an employee is paid different rates for different jobs during the same workweek,...

    In cases where an employee is paid different rates for different jobs during the same workweek, the employers can, at their option, calculate the overtime in one of three ways: Higher Rate for Overtime Hours, Based on Actual Hours Worked, or Rate after the 40th Hour. Using the hours and rates for Eli Employee, Example's son, his gross wages are computed below using the three different methods. Eli makes $14.75 per hour for Job A and $19.05 per hour for...

  • C# coding error with Cengage: MoveEstimator.cs(15,58): error CS1525: Unexpected symbol `total' Compilation failed: 1 error(s), 0...

    C# coding error with Cengage: MoveEstimator.cs(15,58): error CS1525: Unexpected symbol `total' Compilation failed: 1 error(s), 0 warnings Cannot open assembly 'MoveEstimator.exe': No such file or directory. Here is my code and the prompt as well Malcolm Movers charges a base rate of $200 per move plus $150 per hour and $2 per mile. Write a program named MoveEstimator that prompts a user for and accepts estimates for the number of hours for a job and the number of miles involved...

  • The difference between tuvo numbers is 25. The smaller number is 16th of the larger number...

    The difference between tuvo numbers is 25. The smaller number is 16th of the larger number What is the value of the smaller number? A radio station’s signal has a radius of 100 miles If you drrve at a constant speed of 40 miles an hour, nonstop, directly across the diameter of the signal, how long can you listen to the station before the signal fades? If a man runs for an hour and a half at 8 miles an...

  • During the tax season, every Friday, J&J accounting firm provides assistance to people who prepare their own tax returns. Their charges are as follows: If a person has low income (<=25,000) an...

    During the tax season, every Friday, J&J accounting firm provides assistance to people who prepare their own tax returns. Their charges are as follows: If a person has low income (<=25,000) and the consulting time is less than or equal to 30 minutes, there are no charges; otherwise the srvice charges 40% of the regular hourly rate for the time over 30 minutes. For others, if the consulting time is less than or equal to 20 minutes, there are no...

  • ut References Mailings Review View Help Part 2 Yikes! He'll clearly have to complete more than...

    ut References Mailings Review View Help Part 2 Yikes! He'll clearly have to complete more than 10 jobs. W.L. needs to be able to at least cover his costs. Still using the preliminary estimates provided, how many jobs would W.T. have to complete to break even? What would that be in dollars? $ (1) Contribution margin: Sales price per job Less: Variable costs per job =Contribution margin per job jobs (2) Break-even point in units: Fixed costs Contribution margin per...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT