Problem Solving with C++ (9th Edition)
9th Edition
ISBN: 9780133591743
Author: Walter Savitch
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
An employee is paid at a rate of $16.78 per hour for the first 40 hours worked in a week. Any hours over that are paid at the overtime rate of one- and-one-half times that. From the worker’s gross pay, 6% is withheld for Social Security tax, 14% is withheld for federal income tax, 5% is withheld for state income tax, and $10 per week is withheld for union dues. If the worker has three or more dependents, then an additional $35 is withheld to cover the extra cost of health insurance beyond what the employer pays. Write a program that will read in the number of hours worked in a week and the number of dependents as input and will then output the worker’s gross pay, each withholding amount, and the net take-home pay for the week. For a harder version, write your program so that it allows the calcula- tion to be repeated as often as the user wishes. If this is a class exercise, ask your instructor whether you should do this harder version.
A student may apply for an arts college or an engineering college after his school. Admission to arts college or engineering college, is based on the marks obtained in the six subjects: English, Second language, Maths, Physics, Chemistry and Computer Science. Both the applications have the following details: application number, name, age, marks in all six subjects and cut-off for the eligibility. For Arts college, cut-off is the average of marks in all the subjects and whereas for engineering colleges cut-off is the average of marks in maths, physics, chemistry plus the marks scored in the entrance exam. Given all the required details, Design an OOP model to compute the cut-off marks and implement it using Java.
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.
Chapter 2 Solutions
Problem Solving with C++ (9th 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...
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
- Workers at a particular company are paid at a rate of 150.00 per hour for up to 40 hours of work at hour over that is paid at a rate of 1.5 times the normal rate. From the worker’s gross pay, 14% is withheld for income tax, 5% withheld for social security system tax, and 13% is withheld for state income tax. An additional 10% is withheld if the worker has 3 or more covered dependents to cover extra cost of health insurance. Draw the flowchart and write or code the C program that outputs the worker’s gross pay, each withholding and the net take home pay for the week.arrow_forwardWorkers at a particular company are paid at a rate of 150.00 per hour for up to 40 hours of work at hour over that is paid at a rate of 1.5 times the normal rate. From the worker’s gross pay, 14% is withheld for income tax, 5% withheld for social security system tax, and 13% is withheld for state income tax. An additional 10% is withheld if the worker has 3 or more covered dependents to cover extra cost of health insurance. Draw the flowchart and code the C program that outputs the worker’s gross pay, each withholding and the net take home pay for the week.arrow_forwardAl Watan supermarket has hire-purchases scheme for locals and expats. The customers will get the credit facility if they satisfy any of the following conditions: 1- The customer must hold the present job for more than 5 years and reside in the same place at least for 3 years. In this case, the customer will get credit upto rupees 300 omr. 2- The monthly salary of the customer must exceed 1000 omr and must hold the present job for more than 5 years. In this case credit will be given upto rupees 500 omr. 3- The monthly salary must exceed 1000 omr and reside at the same place at least for 3 years. In this case credit will be given upto 500 omr. 4- In the case, the customer?s monthly salary exceeds 1000 omr, holds the present job for more than 5 years and also reside in the same place at least for the 3 years, the credit facility will be upto 1000 omr 5- The credit facility is rejected for all other customers. Prepare a Decision Table for this hire- purchase scheme.arrow_forward
- 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?arrow_forwardDuring the tax season, every Friday, the J & J tax accounting firm provides assistance to people who prepare their own tax returns. Their charges are as follows:a. 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 service charges are 40% of the regular hourly rate for the time over 30 minutes.b. For others, if the Consulting time is less than or equal to 20 minutes, there are no service charges; otherwise, service charges are 70% of the regular hourly rate for the time over 20 minutes.(For example, suppose that a person who has low income is spent 1 hour and 15 minutes, and the hourly rate is $70.00. Then the billing amount is $70.00 x 40 x (45/60) = $21.00). Write a program that prompts the user to enter the hourly rate, the total Consulting time, and whether the person has a low income. The program should output the building of Mount your program must contain a function that takes as input…arrow_forwardA real estate agency pays a sales representative monthly minimum income of 1000, 54 TL, additional allowance according to his/her title, plus 200 TL for each property sold by the sales representative in that month and a certain amount of the sales amount. Additional allowance amounts by title and bonus rates are given in the tables below: Title Additional Allowance (TL) Trainee (1) Beginner (2) 250 350 Expert (3) 500 Senior (4) 750 Sales Amount (TL) Bonus Rate (%) 0- 499.999,99 0.25 500.000- 999.999,99 0.5 1.000.000- 1.999.999,99 0.75 2.000.000-... 1 By adhering the rules stated above, find the total salary amount of a sales representative for a particular month, by obtaining the title of a sales representative from the user (1 for the trainee, 2 for the novice, 3 for the specialist, 4 for the senior), the number of real estate sold this month and the total sales amount made by the sales representative. Write a MATLAB code that prints the total salary on the screen using the…arrow_forward
- A real estate agency pays a sales representative monthly minimum income of 1000, 54 TL, additional allowance according to his/her title, plus 200 TL for each property sold by the sales representative in that month and a certain amount of the sales amount. Additional allowance amounts by title and bonus rates are given in the tables below: Title Additional Allowance (TL) Trainee (1) 250 Beginner (2) 350 Expert (3) Senior (4) 500 750 Sales Amount (TL) Bonus Rate (%) 0- 499.999,99 0.25 500.000- 999.999,99 0.5 1.000.000- 1.999.999,99 0.75 2.000.000-.. 1 By adhering the rules stated above, find the total salary amount of a sales representative for a particular month, by obtaining the title of a sales representative from the user (1 for the trainee, 2 for the novice, 3 for the specialist, 4 for the senior), the number of real estate sold this month and the total sales amount made by the sales representative. Write a C code that prints the total salary on the screen using the switch-case…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_forwardYour 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_forward
- Amarillo Video Store is planning a promotional give-away for its long-standing customers. If the customer has been a member for 18 months or more he/she will receive a coupon booklet allowing him/her to hire 4 movies for free. If during that same 18 months he/she has hired at least 12 videos, he/she will receive an additional 3 free movie hire vouchers. If the customer’s membership is less than 18 months and he/she has hired at least 12 videos then he/she will receive 2 free movie hire vouchers. All members will receive a Thank You letter and “Yentia Obiaa” music video. Construct a Decision Tree for the above scenario.arrow_forwardA company sales manager requires a sales analysis of the two products on offer atthe end of the month. The company employs five salespeople. Input values for each salesperson are name, number, gender, and total units sold forthe month, for each product (one and two). The salary of each salesperson is strictly commission-based. Each salespersonearns a basic commission calculated as 12.5% of his/her total sales. If a salesperson sells more than R1 000 of product two, he or she receives anadditional 10% commission on product two. If not, commission for sales of producttwo is reduced to 5% (i.e. instead of receiving the basic 12.5% commission for salesof product two, a penalty is paid). If a saleswoman sells more than R500 of product one, she receives a bonus of R100. An added bonus of R750 is given to each salesperson whose total commission ismore than R6 000. Each employee receives a printed pay-slip showing all the employee details, grosspay, all the deductions and/or additions,…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
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Operations Research : Applications and AlgorithmsComputer ScienceISBN:9780534380588Author:Wayne L. WinstonPublisher:Brooks ColeC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning