Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please make it simple using c++ xcode or any c++ tool... Chapter 11, Programming Challenge #15 (p.656) Write a program that calculates pay for either

please make it simple using c++ xcode or any c++ tool...

Chapter 11, Programming Challenge #15 (p.656)

Write a program that calculates pay for either an hourly paid worker or a salaried worker. Hourly paid workers are paid their hourly pay rate times the number of hours worked. Salaried workers are paid their regular salary plus any bonus they may have earned. The program should declare two structures for the following data:

Hourly Paid

HoursWorked

HourlyRate

Bonus

The program should also declare a union with two members. Each member should be a structure variable: one for the hourly paid worker and another for the salaried worker. The union should be part of another structure that also contains a flag for what portion of the union should be used. (If you have questions about this part, please email the instructor)

The program should ask the user whether he or she is calculating the pay for an hourly paid worker or a salaried worker. Regardless of which the user selects, the appropriate members of the union will be used to store the data that will be used to calculate the pay.

Use the following flow structure and functions:

Function: Main Askes user if salaried or hourly. Calls appropriate function based on answer to gather information about the worker. Main should receive a worker pointer back. Main then calls the print function for the worker.

Function: getHourly Asks the user for the hourly rate and number of hours worked, storing the answers in a new worker object, which it returns

Function getSalaried Asks the user for the salary and bonus for a worker, storing the answers in a new worker object, which it returns

Function printWorker takes a worker object, and prints out a report for the information about the worker, including the gross pay (which would be calculated)

Note:

Input validation not required, but would be no negative numbers, and no values greater than 80 for hours worked.

Your two structures must be named hourly and salaried, the union should be named worker

Accept both capital and lowercase letters for selecting what type of worker from the user

Sample Output:

(H)ourly or (S)alaried? S

Enter the salary amount: 23058

Enter the bonus amount: 3802

Salaried Worker

Salary: $23058.00

Bonus: $3802.00

----------

Gross Pay: $26860.00

Press any key to continue . . .

====================================

(H)ourly or (S)alaried? H

Enter the number of hours worked: 39

Enter the hourly pay rate: 14.83

Hourly Worker

Hours: 39

Rate: $14.83

----------

Gross Pay: $578.37

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

More Books

Students also viewed these Databases questions

Question

3. Is IBMs program really a mentoring program? Why or why not?

Answered: 1 week ago