Write program named demojobs for harolds home services

Assignment Help C/C++ Programming
Reference no: EM131259094

1 a. Create a program named FriendList that declares an array of eight Friend objects and prompts the user to enter data about the friends. Display the Friend objects in alphabetical order by first name. The Friend class includes auto-implemented properties for the Friend's name, phone number, and three integers that together represent the Friend's birthday-month, day, and year.

b. Create a FriendBirthday program that modifies the FriendList program created in Exercise 9a so that after the list of Friend objects is displayed, the program prompts the user for a specific Friend's name and the program returns the Friend's phone number and birthday. Display an appropriate message if the friend requested by the user is not found.

c. Create a program named AllFriendsInSameMonth that modifies the program in Exercise 9b so that after the requested Friend's birthday is displayed, the program also displays a list of every Friend who has a birthday in the same month.

2. a. Write a program named demojobs for Harold's Home Services. The program should instantiate several Job objects and demonstrate their methods. The Job class contains four data fields-description (for example, "wash windows"), time in hours to complete (for example, 3.5), per-hour rate charged (for example, $25.00), and total fee (hourly rate times hours). Include properties to get and set each field except the total fee-that field will be read-only, and its value is calculated each time either the hourly fee or the number of hours is set. Overload the + operator so that two Jobs can be added. The sum of two Jobs is a new Job containing the descriptions of both original Jobs (joined by "and"), the sum of the time in hours for the original Jobs, and the average of the hourly rate for the original Jobs.

b. Harold has realized that his method for computing the fee for combined jobs is not fair. For example, consider the following:
- His fee for painting a house is $100 per hour. If a job takes 10 hours, he earns $1000.
- His fee for dog walking is $10 per hour. If a job takes 1 hour, he earns $10.
- If he combines the two jobs and works a total of 11 hours, he earns only the average rate of $55 per hour, or $605.
Devise an improved, weighted method for calculating Harold's fees for combined Jobs and include it in the overloaded operator+() method. Write a program named DemoJobs2 that demonstrates all the methods in the class work correctly.

3. a. Write a FractionDemo program that instantiates several Fraction objects and demonstrates that their methods work correctly.

Create a Fraction class with fields that hold a whole number, a numerator, and a denominator.

In addition:
- Create properties for each field. The setaccessor for the denominator should not allow a 0 value; the value defaults to 1.
- Add three constructors. One takes three parameters for a whole number, numerator, and denominator. Another accepts two parameters for the numerator and denominator; when this constructor is used, the whole number value is 0. The last constructor is parameterless; it sets the whole number and numerator to 0 and the denominator to 1. (After construction, Fractions do not have to be reduced to proper form. For example, even though 3/9 could be reduced to 1/3, your constructors do not have to perform this task.)
- Add a Reduce() method that reduces a Fraction if it is in improper form. For example, 2/4 should be reduced to 1/2.
- Add an operator+() method that adds two Fractions. To add two fractions, first eliminate any whole number part of the value. For example, 2 1/4 becomes 9/4 and 1 3/5 becomes 8/5. Find a common denominator and convert the fractions to it. For example, when adding 9/4 and 8/5, you can convert them to 45/20 and 32/20. Then you can add the numerators, giving 77/20. Finally, call the Reduce() method to reduce the result, restoring any whole number value so the fractional part of the number is less than 1. For example, 77/20 becomes 3 17/20.

- Include a function that returns a string that contains a Fraction in the usual display format-the whole number, a space, the numerator, a slash (/), and a denominator. When the whole number is 0, just the Fraction part of the value should be displayed (for example, 1/2 instead of 0 1/2). If the numerator is 0, just the whole number should be displayed (for example, 2 instead of 2 0/3).

b. Add an operator*() method to the Fraction class created in Exercise 11a so that it correctly multiplies two Fractions. The result should be in proper, reduced format. Demonstrate that the method works correctly in a program named FractionDemo2.

c. Write a program named FractionDemo3 that includes an array of four Fractions. Prompt the user for values for each. Display every possible combination of addition results and every possible combination of multiplication results for each Fraction pair (that is, each type will have 16 results).

Verified Expert

In this assignment totally 8 c++ programs are done. Three of the program is based on Friend list three on fraction and three on jobs. This program is used to test the understanding on objects, array of objects, string manipulation, operator overloading,constructor overloading etc. The output of each of the program is provided with each program. In operator overloading the binary operator +(Addition) and *(Multiplication) operator are overloaded. The function overloading is performed in Fraction class.

Reference no: EM131259094

Questions Cloud

Implementing new target market in connection : Expansion of Target Market: Implementing new target market in connection with an already existing one will maximize sales immediately. By expanding on the target market we expand on the business as well.
Annual rate of return compounded annually : Assuming a 7.25% annual rate of return compounded annually over a period of ten years, how much principal would a person need to invest in order to achieve a future amount of $12,500?
Example of a sequence that gets arbitrarily close : (a) If possible, write down a convergent sequence that is not bounded. If this is not possible, BRIEFLY explain why (b) Give an example of a sequence that gets arbitrarily close to L=1, but does not converge to L=1.
Describe and apply various dimensions of management : Discuss the roles managers perform, the skills they need to execute those roles effectively, and the way new information technology is affecting these roles and skills. Compare and contrast the principal challenges managers face in today's increas..
Write program named demojobs for harolds home services : Create a program named FriendList that declares an array of eight Friend objects and prompts the user to enter data about the friends. Display the Friend objects in alphabetical order by first name.
Find manufacturing lead time for a pari coming off the line : Suppose the part in previous Problem 2.5 is made in very large quantities on a production line in which an automated work handling system is used to transfer parts between matches.
Compute the sample mean standard deviation and median : Data were collected as part of a study or coffee consumption among graduate students. The following reflect cups per day consumed: Use the Data Analysis Tool to compute the sample mean, standard deviation, and median.
What is this gift worth at the present time : Your rich aunt gives you a high school graduation present of $110,000. Her present is in the form of a 7-year bond with an annual interest rate of 8.4%. The bond says that it will be worth $110,000 in 7 years.
Determining the area of a triangle : The base of a triangle is 4 inches longer than the height. If its area is 70 square inches, then what are the base and the height?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a program that inputs two characters

Write a program that inputs two characters from the keyboard and passes them to function packCharacters.

  Implement the program and find the item

This would be a function called into program. Struggling with the search aspect. Any clarification is greatly appreciated. File is 'inventory.dat'

  What does the return statement do

What is the purpose of the function header?How may you identify the body of a function?  What does the return statement do?

  Display your name in the title bar

Display your name in the title bar of the browser, declare the DOCTYPE for HTML5, and create a comment listing the lab number, the author, and the date.

  Prepare an arbitrary sinusoidal waveform

Create a program to compute the derivative of an arbitrary input function, with arbitrary duration and arbitrary limits

  Suggest an application system

Prompt for user login to begin using the system, provide an avenue for users to enter test data - Suggest an application system which is able to perform some arithmetic computations, like commission system, encryption system, timer system, etc, fro..

  Write a program to analyze students course marks

Write a program to analyze students course marks. The program should read in students course marks from "m2-grading.txt". The data file has a headline including students ID#, course-1marks, course-2 marks and course-3 markes.

  Test a program that prompts for the user

Write and test a program that prompts for the user to input a file name and uses two functions head() and tail() - head() displays the first 10 lines of a file

  Create the first part of a rock paper scissors game

Create the first part of a Rock, Paper, Scissors game.  Tell the user what you are playing and then ask them to choose either rock, paper or scissors.  After they choose tell them what they chose.  If they make an invalid choice, let them know.  Y..

  Program two decimal places

Write a program that prompts the user to enter the mass of a person in kilograms and outputs the equivalent weight in pounds. Output both  the mass and the weight rounded to two decimal places. (Note that for  standard Earth gravity, 1 kilogram =..

  Problem on c++ tools

When working in teams (at most two students per team), send one solution file per team.

  Program that would display a letter to a friend

Writing a c++ program that would display a letter to a friend? It should have a proper format like name, friends name, address.....etc

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd