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 program that utilizes the concept of conditional execution, takes a string as input, and: prints the sentence "Yes - Spa
rodikova [14]

Answer:

<em>Written in Python</em>

inputt = input()

if inputt == "SPATHIPHYLLUM":

     print("Yes - Spathiphyllum is the best plant ever!")

elif inputt == "spathiphyllum":

     print("No, I want a big Spathiphyllum!")

else:

     print("Spathiphyllum! Not"+ inputt+"!")

Explanation:

This line gets user input

inputt = input()

This line checks if input is uppercase SPATHIPHYLLUM and executes the corresponding print statement, if true

if inputt == "SPATHIPHYLLUM":

     print("Yes - Spathiphyllum is the best plant ever!")

This line checks if input is uppercase spathiphyllum and executes the corresponding print statement, if true

elif inputt == "spathiphyllum":

     print("No, I want a big Spathiphyllum!")

If user input is not upper or lower case of Spathiphyllum, the following if condition is considered

else:

     print("Spathiphyllum! Not"+ inputt+"!")

4 0
4 years ago
When the system denies access to someone who is authorized it is called a - false negative?
babunello [35]
The computer declined the process for the password
5 0
4 years ago
Create a 4x5 matrix with ones everywhere and zeros on the last row.
Stells [14]

Answer:

#include <iostream>

using namespace std;

int main() {

   int a[4][5];//declaring a matrix of 4 rows and 5 columns.

   for(int i=0;i<4;i++)

   {

       for(int j=0;j<5;j++)

       {

           if(i==3)//initializing last row as 0.

           {

               a[i][j]=0;

           }

           else//initializing last row as 1.

           {

               a[i][j]=1;

           }

       }

   }

   for(int i=0;i<4;i++)

   {

       for(int j=0;j<5;j++)

       cout<<a[i][j]<<" ";//printing the matrix.

       cout<<endl;

   }

return 0;

}

Output:-

1 1 1 1 1  

1 1 1 1 1  

1 1 1 1 1  

0 0 0 0 0

Explanation:

I have created a matrix of size 4 rows and 5 columns.I have used for loops to fill the array.To fill the last row with 0 i have used if statement.else we are filling it with 1.

7 0
3 years ago
What project started the development of inter-network connections using tcp/ip that has evolved in to the internet today
Vinvika [58]
The <span>ARPANET </span><span>project started the development of inter-network connections using TCP/IP that has evolved in to the internet today</span>
4 0
3 years ago
Please help asap! i’ll give brainliest to the right answer
Lemur [1.5K]

Answer:

import turtle

my_turtle = turtle.Turtle()

my_turtle.speed(0)

my_turtle.pendown()

colours = ["yellow", "blue", "red", "orange", "cyan", "pink", "green", "brown"]

for sides in range(8):

   my_turtle.pencolor(colours[sides])

   my_turtle.forward(100)

   my_turtle.left(45)

Explanation:

  • The pencolor statement must be inserted before the forward() call otherwise you have no control over the color of the first line.
  • You don't need the count variable, since the 'sides' variable is a perfect counter to index the colours array.
8 0
3 years ago
Other questions:
  • Write the definition of a function named alternator that receives no parameters and returns true the first time it is invoked, r
    12·1 answer
  • Edhesive 3.4 question 2
    11·2 answers
  • to the nearest millimeter a cell phone is 123 long and 54 mm wide what is the ratio of width to length
    12·1 answer
  • Ted reads a sentence: The man said that it would take 10 to 12 days for a reply. He believes the hyphen symbol can replace the w
    11·1 answer
  • All of the following are ways to save money on transportation except :
    7·1 answer
  • When did computer networking go beyond the walls of the firm?
    15·1 answer
  • What is the output of the following code<br> X = 06<br> y = 0<br> print (x ** y)
    12·1 answer
  • After inserting a video into your slide how can you test it
    11·1 answer
  • How is unqualified assumptions a disadvantage of communication​
    14·1 answer
  • Your connection to this site is not secure how to fix.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!