Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 2, Problem 6PP
Program Plan Intro
Employee Payroll
Program Plan:
- Include required header files.
- Initializes value for pay rate, social security tax, federal income tax, state income tax, union dues, over time rate and health insurance cost using “const” modifier.
- Define main function.
- Declare “double” variables for hours worked, gross pay, overtime amount, social security amount, federal income tax amount, state income tax amount, union dues amount and net pay amount.
- Declare “int” variables for number of hours worked and number of dependents.
- Declare “char” variable for user option.
- Insert the function for display all output in two decimal places.
- Performs “do-while” loop. In this loop, repeat the below steps until the character is not “y” or “Y”.
- If the hours worked is less than or equal to “40”, then compute the amount for gross pay.
- Otherwise, compute overtime amount and gross pay amount.
- Compute the amount for social security tax, income tax, state tax, and net.
- If the number of dependents is greater than or equal to “3”, the compute the new net pay amount.
- Display the hours worked and its regular pay rate.
- If the hours worked greater than “40”, then display the overtime amount.
- Display the workers gross pay, social security tax withheld amount, federal income tax withheld amount, and state income tax withheld amount.
- If the number of dependents are greater than or equal to “3”, then display the health insurance withheld amount, union dues amount and net take-home pay.
- Create the prompt statement for user repeat calculation and read the user option.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
q no 3: A certain grade of steel is graded according to the following condition:
Hardness must be greater than 40
Carbon contents must be less than 0.8
Tensile strength must be greater than 5000
The grades are as follows:
Grade is 10 if all the three conditions are met.
Grade is 9 if conditions 1 and 2 are met.
Grade is 8 if conditions 2 and 3 are met.
Grade is 7 if conditions 1 and 3 are met.
Grade is 6 if only one condition is met.
Grade is 5 if none of the conditions are met.
Write a C++ program which will require user to give values of hardness, carbon content and tensile strength of the steel under consideration then determine the grade of steel and outputs the grade of the steel.
Q7:The electricity accounts of residents in a very small town are
calculated as follows:
if 500 units or less are used the cost is 2 cents per unit;
> if more than 500, but not more than 1000 units are used, the cost is
$10 for the first 500 units, and then 5 cents for every unit in excess of
500;
> if more than 1000 units are used, the cost is $35 for the first 1000 units
plus 10 cents for every unit in excess of 1000;
in addition, a basic service fee of $5 is charged, no matter how much
electricity is used.
Q8:Write a program which enters the following five consumptions into a
vector, and uses a for loop to calculate and display the total charge for
each one: 200, 500, 700, 1000, 1500. (Answers: $9 $15, $25, $40, $90)
Read this:Selective Service Registration
Registration with the Selective Service is mandatory in America. The law states "it is the duty of every male
citizen of the United States between the ages of 18 and 25, to register." The law does not require women
to register.
Failure to register for selective service is a crime. If found guilty, a person could be fined up to $250,000.
They might also receive a sentence of five years in prison.
All men over 18 should register online at the Selective Service System website (www.sss.gov).
Registration can also be done at any US Post Office. It is a duty that allows for freedom in America.
Explain the purpose for registering with the Selective Service System. Is this action a duty or a responsibility?
Chapter 2 Solutions
Problem Solving with C++ (10th Edition)
Ch. 2.1 - Give the declaration for two variables called feet...Ch. 2.1 - Give the declaration for two variables called...Ch. 2.1 - Give a C++ statement that will change the value of...Ch. 2.1 - Give a C++ statement that will increase the value...Ch. 2.1 - Give a C++ statement that will change the value of...Ch. 2.1 - Prob. 6STECh. 2.1 - Prob. 7STECh. 2.2 - Give an output statement that will produce the...Ch. 2.2 - Give an input statement that will fill the...Ch. 2.2 - Prob. 10STE
Ch. 2.2 - Write a complete C++ program that writes the...Ch. 2.2 - Write a complete C++ program that reads in two...Ch. 2.2 - Prob. 13STECh. 2.2 - Write a short program that declares and...Ch. 2.3 - Convert each of the following mathematical...Ch. 2.3 - Prob. 16STECh. 2.3 - What is the output of the following program lines...Ch. 2.3 - Write a complete C++ program that reads two whole...Ch. 2.3 - Given the following fragment that purports to...Ch. 2.3 - What is the output of the following program lines...Ch. 2.4 - Write an if-else statement that outputs the word...Ch. 2.4 - Suppose savings and expenses are variables of type...Ch. 2.4 - Write an if-else statement that outputs the word...Ch. 2.4 - Write an if-else statement that outputs the word...Ch. 2.4 - Consider a quadratic expression, say x2 x 2...Ch. 2.4 - Consider the quadratic expression x2 4x + 3...Ch. 2.4 - What is the output of the following cout...Ch. 2.4 - What is the output produced by the following (when...Ch. 2.4 - What output would be produced in the previous...Ch. 2.4 - What is the output produced by the following (when...Ch. 2.4 - What is the output produced by the following (when...Ch. 2.4 - What is the most important difference between a...Ch. 2.4 - What is the output produced by the following (when...Ch. 2.4 - Write a complete C++ program that outputs the...Ch. 2.5 - The following if-else statement will compile and...Ch. 2.5 - Prob. 36STECh. 2.5 - Write a complete C++ program that asks the user...Ch. 2 - A metric ton is 35,273.92 ounces. Write a program...Ch. 2 - The Babylonian algorithm to compute the square...Ch. 2 - Many treadmills output the speed of the treadmill...Ch. 2 - Write a program that plays the game of Mad Lib....Ch. 2 - The following is a short program that computes the...Ch. 2 - A government research lab has concluded that an...Ch. 2 - Workers at a particular company have won a 7.6%...Ch. 2 - Modify your program from Programming Project 2 so...Ch. 2 - Negotiating a consumer loan is not always...Ch. 2 - Write a program that determines whether a meeting...Ch. 2 - Prob. 6PPCh. 2 - It is difficult to make a budget that spans...Ch. 2 - You have just purchased a stereo system that cost...Ch. 2 - Write a program that reads in ten whole numbers...Ch. 2 - Modify your program from Programming Project 9 so...Ch. 2 - Sound travels through air as a result of...Ch. 2 - Prob. 12PPCh. 2 - The HarrisBenedict equation estimates the number...Ch. 2 - Write a program that calculates the total grade...Ch. 2 - It is important to consider the effect of thermal...Ch. 2 - Prob. 16PP
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- A retail store has a preferred customer plan where customers can earn discounts on all their purchases. The amount of a customer’s discount is determined by the amount of the customer’s cumulative purchases in the store as follows: • When a preferred customer spends $500, he or she gets a 5 percent discount on all future purchases. • When a preferred customer spends $1,000, he or she gets a 6 percent discount on all future purchases. • When a preferred customer spends $1,500, he or she gets a 7 percent discount on all future purchases. • When a preferred customer spends $2,000 or more, he or she gets a 10 percent discount on all future purchases. Design a class named PreferredCustomer, which is derived from the Customer class you created in Programming Problem 4. The PreferredCustomer class should have properties for the amount of the customer’s purchases and the customer’s discount level. Demonstrate the class in a simple application.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_forwardThe United States federal personal income tax is calculated based on filing status and taxable income. There are four filing statuses: single filers, married filing jointly, married filing separately, and head of household. The tax rates vary every year. Table 4.2 shows the rates for 2009. If you are, say, single with a taxable income of $10,000, the first $8,350 is taxed at 10% and the other $1,650 is taxed at 15%. So, your tax is $1,082.50. TABLE 4.2 2009 U.S. Federal Personal Tax Rates Marginal Tax Rate 10% 15% 25% 28% 33% 35% Single $0-$8,350 $8,351-$33.950 $33,951-$82,250 $82,251 - $171,550 $171,551-$372,950 $372,951+ Married Filing Jointly $0-$16,700 $16,701-$67,900 $67.901-$137,050 $137,051 - $208,850 $208,851-$372,950 $372,951+ Married Filing Separately $0-$8,350 $8,351-$33,950 $33,951 - $68,525 $68,526-$104,425 $104,426-$186,475 $186,476+ Head of Household $0-$11,950 $11,951-$45,500 $45,501-$117,450 $117.451-$190,200 $190,201-$372,950 $372.951+ You are to write a program to…arrow_forward
- Your English professor has announced the following grading policy: For each essay, the highest score in the class will be entered as a 100%; all other scores will be entered as the percent of that top score. For example, if the highest essay is a 50 out of 100, it will be counted as a perfect paper, and essays with a score of 40 out of 100 will be entered as an 80%. The final grade for the course will be determined using these adjusted percentages, with 90% and above an A, 80% and above a B, 70% and above a C and below 70% not passing. The students all get together and decide not to work hard on the next paper because if nobody does well, they will all do okay. This plan results in a Nash Equilibrium. A.) is a solid commitment device, and thus stable. B.) will be unstable because there is an incentive to break the agreement. C.) will be stable because there are no incentives to deviate. D.) requires everyone to follow their…arrow_forwardWrite collection of production rules to calculate electricity bill as per following rules: •If the units consumed are less than and equal to 300, then the cost is Rs 10/- per unit. •If the units consumed are more than 300 and less than and equal to 500, then the cost is Rs 12/- per unit. •If the units consumed are more than 500 and less than 1000, then the cost is Rs 15/- per unit and surcharge of 15% of bill is added. •If the units consumed are more than 1000, then the cost is Rs 15/- per unit and surcharge of 25% of bill is added. Trace the production rules for the sample execution of the system given below;Write collection of production rules to calculate electricity bill as per following rules: •If the units consumed are less than and equal to 300, then the cost is Rs 10/- per unit. •If the units consumed are more than 300 and less than and equal to 500, then the cost is Rs 12/- per unit. •If the units consumed are more than 500 and less than 1000, then the cost is Rs 15/- per unit…arrow_forward- For all the employees supervised by KING, give them a salary increase, which is equal to the 2% of the company’s average salaryarrow_forward
- A performance venue hosts many concerts a year. Performers perform several times a year for the concerts. Each concert has one or more performers and has a name and a specified seating arrangement. A concert is held in one (and only one) of several concert halls, each of which has a room number and the number of seats. Each concert generates revenues from the sales of tickets. Assume that the price of the ticket is the same for the same concert, but different prices for different concerts.Identify several attributes and a key field for each entity. Represent this situation of concerts and performers with an E-R diagramarrow_forwardIn the US Higher Education sector, a degree is classified using a Grade Point Average (GPA). The grades ‘A’, ‘B’, ‘C’, ‘D’ or ‘F’ are called academic grades. Each ‘A’ is worth 4 points, each ‘B’ is worth 3 points, each ‘C’ is worth 2 points, each ‘D’ is worth 1 point and each ‘F’ is worth 0 points. The GPA is found by calculating the number of points and then dividing by the number of academic grades. A student may also have a non-academic grade of ‘W’ (for withdrew) which is not counted at all in the calculation. You can assume that the student will have at least one academic grade in their list of grades. There are many ways of calculating a GPA from a list of grades, but you must follow the algorithm given by this top-level decomposition: > Find GPA. >> Input a list of academic and non-academic grades. >> Create a new list that consists of the number of points for each academic grade in the input list. >> Add up the values in the new list and divide by the…arrow_forwardLast month Joe purchased 100 shares of stock. Here are the details of the purchase: • When Joe purchased the stock, he paid $32.87 per share.• Joe paid his stock broker a commission that amounted to 2% of the amount he paid for the stock. Two months later Joe sold the stock. Here are the details of the sale:• He sold the stock for $33.92 per share.• He paid his stock broker another commission that amounted to 2% of the amount he received for the stock. Write a program that displays the following information:• The amount of money Joe paid for the stock.• The amount of commission Joe paid his broker when he bought the stock.• The amount that Joe sold the stock for.• The amount of commission Joe paid his broker when he sold the stock.• The amount of profit or loss that Joe had after selling his stock and paying both broker commissions.arrow_forward
- Question 16arrow_forward1. Calculate the Overtime Pay for 5 Service men Enter the Service man Name, Enter the Type of Service, Enter Monthly Basic Salary, Enter Number of Days of Overtime. The options of Type of Service men will be "Army", “Navy" and “Airforce". If the type of Service is "Airforce'", the Overtime Rate is 30%. If the type of Service is “Army", the Overtime Rate is 28%. If the type of Service is “Navy", the Overtime Rate is 26%. Overtime pay = Daily rate * Numbers of Days Overtime * Overtime Rate. Daily rate = Monthly Basic Salary / 22. Display Service man Name / Service Type / Daily Rate / Overtime Pay for all the 5 Service men Save your shell script as servicemen.sharrow_forwardwrite a c pragram to read the age of a candidate and determine whether it is eligible for casting his or her votearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningOperations Research : Applications and AlgorithmsComputer ScienceISBN:9780534380588Author:Wayne L. WinstonPublisher:Brooks ColeC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr