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

  Brownian motion is a physical phenomenon

Brownian motion is a physical phenomenon which can be observed, for instance, when a small particle is immersed in a liquid.

  Compdateoracle is a perfect function

CompdateOracle is a perfect function without any bug to compare dates, Find out 3 issues with this random testing scheme. For each of the issue found, propose an improvement. Mention issue in one line and improvement proposal in less then 3 lines. Fi..

  Write a c++ program that would take two 3x3 matrix

Write a C++ program that would take two 3x3 matrix and outputs the results of adding, subtracting and multiplying two matrices. Create at least three functions: one that performs addition,

  Write a program to check whether a number is even or odd

Write a C++ program to check whether a number entered by user is even or odd.

  Program to declare variables in c

What is the value of the following (Boolean) expression?

  Program to compute the diameter in centimeters of steel rod

Input the compression load. Print the type of material, load, allowable stress, and diameter. Used formatted output with field with specifications that align output.

  What are the row and column indexes of chicago in the array

What is the value of the expression cities[2][1]?

  Generate a random number

Generate a random number between 1 – 5 and 3 – 8 for express and normal lanes, respectively. This represents the arrival time of the first customer into each lane. Set the variable for total time elapsed to 0.

  Creating a database design in visior

Use "Appendix A: Designing Databases with Visio Professional: A Tutorial," to help you complete Section 1: Visio Database Design. (Note: This tutorial focuses on the use of Microsoft Visio. Open source applications are not covered in Appendix A..

  Supposed to swap numbers

The program is supposed to swap numbers, but I am stuck something is wrong! It does not swap them it repeats the second number, please help to fix! Thanks, this is in C++.

  Calculates different formulas that converge to the number pi

Write a C program (Care should be taken not to use extensions of C + + language in your work ) that calculates different formulas that converge to the number  pi,  to compare the speed of convergence of these formulas. Each form will be calculated by..

  Write a program to illustrate how to use your class

Declare an array of 10 components of type bankAccount to process up to 10 customers and write a program to illustrate how to use your class.

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