C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN: 9781337102087
Author: D. S. Malik
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Question
Chapter 2, Problem 18PE
Program Plan Intro
Implementation of a program to compute summer job earnings and spendings
Program Plan:
Write a C++ program with a main function and the required set of statements to accomplish the following:
Prompts the user to enter the hourly pay rate of a summer job and the number of hours worked in a week
Computes the income earned before and after taxes, money spent on clothes, school supplies, savings bonds, and the amount contributed by parents toward buying additional savings bonds
Prints the result
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
You found an exciting summer job for five weeks. It pays, say, $15.50 per hour. Suppose that the total tax you pay on your summer job income is 14%.
After paying the taxes, you spend 10% of your net income to buy new clothes and other accessories for the next school year and 1% to buy school supplies.
After buying clothes and school supplies, you use 25% of the remaining money to buy savings bonds. For each dollar you spend to buy savings bonds, your parents spend $0.50 to buy additional savings bonds for you.
Instructions
Write a program that prompts the user to enter:
The pay rate for an hour and the number of hours you worked each week.
The program then outputs the following:
Your income before and after taxes from your summer job.
The money you spend on clothes and other accessories.
The money you spend on school supplies.
The money you spend to buy savings bonds.
The money your parents spend to buy additional savings bonds for you.
I try this code cengage…
You found an exciting summer job for five weeks. It pays, say, $15.50 per hour. Suppose thatthe total tax you pay on your summer job income is 14%. After paying the taxes, you spend10% of your net income to buy new clothes and other accessories for the next school yearand 1% to buy school supplies. After buying clothes and school supplies, you use 25% of theremaining money to buy savings bonds. For each dollar you spend to buy savings bonds,your parents spend $0.50 to buy additional savings bonds for you. Write a flowchart that prompts the user to enter the number of hours you worked each week. The program thenoutputs the following:a. Your income before and after taxes from your summer job.b. The money you spend on clothes and other accessories.c. The money you spend on school supplies.d. The money you spend to buy savings bonds.e. The money your parents spend to buy additional savings bonds for you.
You found an exciting summer job for five weeks. It
pays a set amount per hour (for example, $15.50).
Suppose the total tax you pay on your summer job
income is 16%. After paying the taxes, you spend
12% of your net income (income after taxes) to buy
new clothes and other accessories for the next school
year and 1% on buying school supplies. After buying
clothes and school supplies, you use 30% of the
remaining money to buy savings bonds. For each
whole dollar, you spend to purchase savings bonds
(rounded down), your parents contribute $0.50 of
additional savings bonds for you.
Write a program that prompts the user to enter the
pay rate per hour and the number of hours you
worked each week. The program then outputs the
following:
a. Your income before and after taxes from your
summer job.
b. The money you spend on clothes and other
accessories.
c. The money you spend on school supplies.
d. The money you spend to buy savings bonds.
e. The money your parents spend to buy
additional…
Chapter 2 Solutions
C++ Programming: From Problem Analysis to Program Design
Ch. 2 - 1. Mark the following statements as true or...Ch. 2 - Prob. 2MCCh. 2 - Which of the following is not a reserved word in...Ch. 2 - Prob. 4SACh. 2 - 5. Are the identifiers quizNo1 and quiznol the...Ch. 2 - 6. Evaluate the following expressions. (3,...Ch. 2 - If int x = 10;, int y = 7;, double z = 4.5;, and...Ch. 2 - Prob. 8CPCh. 2 - 9. Suppose that x, y, z, and w are int variables....Ch. 2 - Prob. 10SA
Ch. 2 - Which of the following are valid C++ assignment...Ch. 2 - Write C++ statements that accomplish the...Ch. 2 - Write each of the following as a C++ expression....Ch. 2 - Prob. 14SACh. 2 - Suppose x, y, and z are int variables and wandt...Ch. 2 - 16. Suppose x, y, and z are int variables and x =...Ch. 2 - Suppose a and b are int variables, c is a double...Ch. 2 - 18. Write C++ statements that accomplish the...Ch. 2 - Which of the following are correct C++ statements?...Ch. 2 - Give meaningful identifiers for the following...Ch. 2 - 21. Write C++ statements to do the following....Ch. 2 - Prob. 22SACh. 2 - The following program has syntax errors. Correct...Ch. 2 - Prob. 24SACh. 2 - Prob. 25SACh. 2 - Preprocessor directives begin with which of the...Ch. 2 - 27. Write equivalent compound statements if...Ch. 2 - 28. Write the following compound statements as...Ch. 2 - 29. Suppose a, b, and c are int variables and a =...Ch. 2 - Suppose a, b, and sum are int variables and c is a...Ch. 2 - Prob. 31SACh. 2 - Prob. 32SACh. 2 - Prob. 33SACh. 2 - Prob. 34SACh. 2 - 1. Write a program that produces the following...Ch. 2 - Prob. 2PECh. 2 - Prob. 3PECh. 2 - 4. Repeat Programming Exercise 3 by declaring...Ch. 2 - Prob. 5PECh. 2 - Prob. 6PECh. 2 - 7. Write a program that prompts the user to input...Ch. 2 - Prob. 8PECh. 2 - 9. Write a program that prompts the user to enter...Ch. 2 - 10. Write a program that prompts the user to input...Ch. 2 - 11. Write a program that prompts the capacity, in...Ch. 2 - 12. Write a C++ program that prompts the user to...Ch. 2 - 13. To make a profit, a local store marks up the...Ch. 2 - 14. (Hard drive storage capacity) If you buy a 40...Ch. 2 - 15. Write a program to implement and test the...Ch. 2 - 16. A milk carton can hold 3.78 liters of milk....Ch. 2 - 17. Redo Programming Exercise 16 so that the user...Ch. 2 - Prob. 18PECh. 2 - 19. Write a program that prompts the user to input...Ch. 2 - 20. For each used car a salesperson sells, the...Ch. 2 - 21. Newton's law states that the force, , between...Ch. 2 - 22. One metric ton is approximately 2,205 pounds....Ch. 2 - 23. Cindy uses the services of a brokerage firm to...Ch. 2 - 24. A piece of wire is to be bent in the form of a...Ch. 2 - 25. Repeat Programming Exercise 24, but the wire...Ch. 2 - 26. A room has one door, two windows, and a...Ch. 2 - Prob. 27PECh. 2 - 28. In an elementary school, a mixture of equal...Ch. 2 - 29. A contractor orders, say, 30 cubic yards of...
Knowledge Booster
Similar questions
- Suppose, you are working in a company ‘X’ where your job is to calculate the profit based on their investment. If the company invests 100,000 USD or less, their profit will be based on 75,000 USD as first 25,000 USD goes to set up the business in the first place. For the first 100,000 USD, the profit margin is low: 4.5%. Therefore, for every 100 dollar they spend, they get a profit of 4.5 dollar. For an investment greater than 100,000 USD, for the first 100,000 USD (actually on 75,000 USD as 25,000 is the setup cost), the profit margin is 4.5% whereas for the rest, it goes up to 8%. For example, if they invest 250,000 USD, they will get an 8% profit for the 150,000 USD. In addition, from the rest 100,000 USD, 25,000 is the setup cost and there will be a 4.5% profit on the rest 75,000. The investment will always be greater or equal to 25,000 and multiple of 100. Complete the RECURSIVE methods below that take an array of integers (investments) and an iterator (always sets to…arrow_forwardSuppose, you are working in a company ‘X’ where your job is to calculate the profit based on their investment. If the company invests 100,000 USD or less, their profit will be based on 75,000 USD as first 25,000 USD goes to set up the business in the first place. For the first 100,000 USD, the profit margin is low: 4.5%. Therefore, for every 100 dollar they spend, they get a profit of 4.5 dollar. For an investment greater than 100,000 USD, for the first 100,000 USD (actually on 75,000 USD as 25,000 is the setup cost), the profit margin is 4.5% where for the rest, it goes up to 8%. For example, if they invest 250,000 USD, they will get an 8% profit for the 150,000 USD. In addition, from the rest 100,000 USD, 25,000 is the setup cost and there will be a 4.5% profit on the rest 75,000. Investment will always be greater or equal to 25,000 and multiple of 100. Complete the RECURSIVE methods below that take an array of integers (investments) and an iterator (always sets to…arrow_forwardFergusonball players are given a star rating based on the number of points that they score and the number of fouls that they commit. Specifically, they are awarded 5 stars for each point scored, and 3 stars are taken away for each foul committed. For every player, the number of points that they score is greater than the number of fouls that they commit. Your job is to determine how many players on a team have a star rating greater than 40. You also need to determine if the team is considered a gold team which means that all the players have a star rating greater than 40. Input Specification The first line of input consists of a positive integer N representing the total number of players on the team. This is followed by a pair of consecutive lines for each player. The first line in a pair is the number of points that the player scored. The second line in a pair is the number of fouls that the player committed. Both the number of points and the number of fouls, are non-negative integers.…arrow_forward
- An oil and gas exploration firm invested $2,000,000 in drilling for natural gas in a new gas field. The firm's geologist believes the field has the potential to produce gas for many years. The revenue resulting from the gas well the first year after drilling is $600,000; based on previous experiences with similar types of wells, it is expected the annual revenue will decrease at an annual rate of 3%. Likewise, the costs of operating the well the first year totals $100,000; costs are expected to increase at an annual rate of 7%. If the firm's MARR is 17%, how long will it take for the firm to recover its investment? Hint: Using Excel's Goal Seek or SOLVER tool leave cell for the number of years required to recover the investment empty. Click here to access the TVM Factor Table calculator. n = L1 yearsarrow_forwardIf the company invests 100,000 USD or less, their profit will be based on 75,000 USD as first 25,000 USD goes to set up the business in the first place. For the first 100,000 USD, the profit margin is low: 4.5%. Therefore, for every 100 dollar they spend, they get a profit of 4.5 dollar. For an investment greater than 100,000 USD, for the first 100,000 USD (actually on 75,000 USD as 25,000 is the setup cost), the profit margin is 4.5% whereas for the rest, it goes up to 8%. For example, if they invest 250,000 USD, they will get an 8% profit for the 150,000 USD. In addition, from the rest 100,000 USD, 25,000 is the setup cost and there will be a 4.5% profit on the rest 75,000. The investment will always be greater or equal to 25,000 and multiple of 100. Complete the RECURSIVE methods below that take an array of integers (investments) and an iterator (always sets to ZERO(‘0’) when the method is initially called) and prints the profit for the corresponding investment. You must…arrow_forwardSuppose you are trying to make a schedule for use of the auditorium for different clubs in a school. The auditorium can be used in the afternoons from Sunday to Thursday. There are five clubs: Music, Drama, Dance, Photography, Computer. There are a few rules that must be followed: a)The auditorium can be used by only one club on a day. b)Computer club wants to use on Monday or Thursday. c)Drama club wants on Wednesday or Thursday. d)Music club is fine with any day. Dance club wants on Monday or Wednesday. e)Photography club wants on Sunday, Tuesday or Wednesday. Formulate this problem as a CSP. Draw the constraint graph. Show the steps followed by backtracking search algorithm and derive a solution.arrow_forward
- A farmer in Georgia has a 100-acre farm on which to plant watermelons and cantaloupes. Every acre planted with watermelons requires 50 gallons of water per day and must be prepared for planting with 20 pounds of fertilizer. Every acre planted with cantaloupes requires 75 gallons of water per day and must be prepared for planting with 15 pounds of fertilizer. The farmer estimates that it will take 2 hours of labor to harvest each acre planted with watermelons and 2.5 hours to harvest each acre planted with cantaloupes. He believes that watermelons will sell for about $3 each, and cantaloupes will sell for about $1 each. Every acre planted with watermelons is expected to yield 90 salable units. Every acre planted with cantaloupes is expected to yield 300 salable units. The farmer can pump about 6,000 gallons of water per day for irrigation purposes from a shallow well. He can buy as much fertilizer as he needs at a cost of $10 per 50-pound bag. Finally, the farmer can hire laborers to…arrow_forwardtry to solve using pythonarrow_forwardWhenever you mail a letter, you must decide how much postage to put on the envelope. You like to use this rule of thumb – use a stamp for every five sheets of paper or fraction thereof. For example, if you have 11 sheets of paper, then you use three stamps. Since you’re parsimonious, if an envelope requires more than three stamps, then you simply don’t mail the envelope. Show how the number of stamps per envelope would be calculated. Provide a solution in the form of pseudocode. Your pseudocode must read in appropriate data and print how many stamps to use.arrow_forward
- A school dance committee is to consist of 2 freshmen, 3 sophomores, 4 juniors, and 5 seniors. If 6 freshmen, 7 sophomores, 9 juniors, and 7 seniors are eligible to be on the committee, in how many ways can the committee be chosen? Your answer is:arrow_forwardIntroduction to Quantitative Methods SEE ATTACHED PHOTO FOR THE PROBLEMarrow_forwardShow your work!arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Operations Research : Applications and AlgorithmsComputer ScienceISBN:9780534380588Author:Wayne L. WinstonPublisher:Brooks Cole
Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole