1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
mash [69]
2 years ago
8

Write a program that calculates pay for either an hourly paid worker or a salaried worker Hourly paid workers are paid their hou

rly 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 followingdata Hourly Paid Salary 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 Accept both capital and lowercase letters for selecting what type of worker from the user
Computers and Technology
1 answer:
swat322 years ago
8 0

The program that is required here is a payroll program. See the explanation below.

<h3>What is a program?</h3>

A program is a series of instructions that are given to a computer in a predetermined language with precise instruction that delivers a specific output.

<h3>What is the required program?</h3>

The program that calculates the pay - (Payroll program) is given as follows:

#include <iostream>

#include <iomanip>                                                                                                                                                                                        

using namespace std;

int main ()

{

int paycode;

int WeeklySalary;

double pay;

int HourlySalary;

int TotalHours;

int GrossWeeklySales;

int pieces;

int PieceWage;

cout << "Enter paycode (-1 to end): ";

cin  >> paycode;

while (1); {

               

                switch (paycode) {

                               case '1':

                                cout << "Manager selected." << endl;

                                cout << "Enter weekly salary: ";

                                cin  >> WeeklySalary;

                               

                                cout << endl;

                               

                                pay = WeeklySalary;

                                cout << "The manager's pay is $ " << pay;

                                cout << endl;

                               

                               

                                break;

                               

                                case '2':

                                cout << "Hourly worker selected." << endl;

                                cout << "Enter the hourly salary: ";

                                cin  >> HourlySalary;

                               

                                cout << endl;

                                cout << "Enter the total hours worked: " << endl;

                                cin  >> TotalHours;

                               

                                         if ( TotalHours <= 40)

                                                  pay = HourlySalary * TotalHours;

                                                 

                                         else

                                                  pay = (40.0 * HourlySalary) + (TotalHours - 40) * (HourlySalary * 1.5);

                                                 

                                 

                                cout << endl;

                                cout << "Worker's pay is $ " << pay;

                               

                                cout << endl;

                                break;

                               

                                case '3':

                                cout << "Commission worker selected." << endl;

                                cout << "Enter gross weekly sales: ";

                                cin  >> GrossWeeklySales;

                               

                                cout << endl;

                                pay = (GrossWeeklySales *.57) + 250;

                                 

                                cout << " Commission worker's pay is $ " << pay;

                                 break;  

                               

                                case '4':

                                cout << "Pieceworker selected." << endl;

                                cout << "Enter number of pieces: ";

                                cin  >> pieces;

                               

                                cout << "Enter wage per piece: ";

                                cin >> PieceWage;

                               

                                pay = pieces * PieceWage;

                               

                                cout << "Pieceworker's pay is $ " << pay;

                                break;

                                                               

                         

}

                               

}

system ("pause");

return 0;

}

Learn more about programs at;
brainly.com/question/1538272
#SPJ1

You might be interested in
write a function that takes a string as parameter, return true if it’s a valid variable name, false otherwise. You can use keywo
never [62]

Answer:

The solution code is written in Python 3:

  1. import keyword  
  2. def checkValidVariable(string):
  3.    if(not keyword.iskeyword(string)):
  4.        return True  
  5.    else:
  6.        return False  
  7. print(checkValidVariable("ABC"))
  8. print(checkValidVariable("assert"))

Explanation:

Firstly, we need to import keyword module so that we can use its iskeyword method to check if a string is registered as Python keyword (Line 1).

Next, we create a function checkValidVariable that takes one input string (Line 3). Within the function body, we use iskeyword method to check if the input string is keyword. Please note the "not" operator is used here. So, if iskeyword return True, the True value will be turned to False by the "not" operator or vice versa (Line 4-5).

We test the function by passing two input string (Line 9-10) and we shall get the sample output as follows:

True

False

8 0
3 years ago
Marie has never used a word processor. In 3 to 4 sentences, describe how she could benefit from using a word processor to comple
pychu [463]
She could be able to present her information in a legible way. She will be able to type quicker than writing, and be more thorough about her writing. She can also benefit by becoming more familiar with different technologies. She can benefit by being able to add information that broadens her knowledge on the subject.

Hope this helps!!
6 0
3 years ago
Read 2 more answers
Compared to other forms of communication, texting does not offer as many message cues.
solmaris [256]
The correct answer is true.
3 0
3 years ago
Can a result that contains road maps for European countries have a highly meets rating
Mice21 [21]

Đápán3e

Explanation:

8 0
3 years ago
The computer uses unallocated space for what​
finlep [7]

A computer uses unallocated space also know as free space to keep a file that has been deleted in its disk until a new file takes it spot and overwrites it.

3 0
4 years ago
Read 2 more answers
Other questions:
  • George and Miguel want to know more about their local and online competitors and about the retail industry. What is the best way
    9·1 answer
  • How is a cell named in microsoft excel 2016
    10·1 answer
  • A sense of scale tells us what about the objects in a picture?
    11·2 answers
  • When specifying keywords to conduct an internet search, which of the following parts of speech will be the most useful??
    6·1 answer
  • When you use information hiding by selecting which properties and methods of a class to make public, you are assured that your d
    14·1 answer
  • Search engines enable you to
    12·1 answer
  • In the RSA system, the receiver does as follows:1. Randomly select two large prime numbers p and q, which always must bekept sec
    6·1 answer
  • Project: big research project
    15·2 answers
  • The notes added to slides can be seen during the presentation. TRUE OR FALSE​
    13·1 answer
  • When network traffic is encrypted, it is invisible and its content and purpose are masked.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!