Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I Have done this much of my code and just need some help with case 2 I am having issues my variables and wanted to

image text in transcribed

I Have done this much of my code and just need some help with case 2 I am having issues my variables and wanted to know if you can help me take a look at my code

// // main.c // lab 3.2 // // Created by Wale Adejumobi on 2/7/20. // Copyright 2020 Wale Adejumobi. All rights reserved. // #include int main() {

float managers_pay, comis_worker, piece, workers, overtime,weekly_sale, gross_weeekly_sales,each_item; int managers_paid= 0, hrly_worker_paid= 0,items_made, pay_per_hour, hrly_worker = 0,hrs_worker_paid; int comis_worker_paid=0, piece_worker_paid=0, paycode=1 ; int loop = 1; while(paycode!=-1){ printf("Enter paycode(-1 to end):"); scanf("%d",&paycode); if (paycode == -1 ) loop = 0; else{ switch(paycode){ case 1 :printf("Manger Selcted"); printf("Enter weekly salary:"); scanf("%f",&managers_pay); printf("The manage's pay is %.2f ", managers_pay); break; case 2 :printf("Hourly Workers Selected. "); printf("Enter weekly salary:"); scanf("%d", &pay_per_hour); printf("How many hours worked: "); scanf("%d", &hrs_worker_paid); hrly_worker = hrly_worker * pay_per_hour; printf("Hourly worker got paid for %d", hrly_worker); break; case 3: printf("Comission Workers selected. Enter gross weekely sales:"); scanf("%f",&gross_weeekly_sales); comis_worker = 250 +((5.7/100)*gross_weeekly_sales); printf("The Commission workers paid is$ %0.2f ",comis_worker);comis_worker_paid++; break; case 4:printf("Peice worker selected. Enter cost of item:"); scanf("%f",&each_item); printf("Enter number of items made:"); scanf("%d", &items_made); printf("The peice workers paid is $%0.2f ",each_item*items_made); break; } } } }

Acknowledge your collaborators or source of solutions, if any. Online submission is required. This exercise is for getting familiar with Repetition & Loop Statements. Do all of the following. A subset of your answers will be graded. 1. (Calculating Weekly Pay) A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who receive a fixed hourly wage for up to the first 40 hours they work and "time-and-a-half" i.e., 1.5 times their hourly wage-for overtime hours worked), commission workers (who receive $250 plus 5.7% of their gross weekly sales), or pieceworkers (who receive a fixed amount of money for each of the items they produce-each pieceworker in this company works on only one type of item). Write a program to compute the weekly pay for each employee. You do not know the number of employees in advance. Each type of employee has its own pay code: Managers have paycode 1, hourly workers have code 2, commission workers have code 3 and pieceworkers have code 4. Use a switch to compute each employee's pay based on that employee's paycode. Within the switch, prompt the user (i.e., the payroll clerk) to enter the appropriate facts your program needs to calculate each employee's pay based on that employee's paycode. An example for the expected output: Enter paycode (-1 to end): 1 Manager selected. Enter weekly salary: 600 The manager's pay is $600.00 Enter paycode ( -1 to end ): 6 Invalid pay code. Enter paycode ( -1 to end ): -1 1 Total number of managers paid Total number of hourly workers paid : 0 Total number of commission workers paid : 0 Total number of piece workers paid :0

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

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions

Question

3. Identify the refusal of the call in Star Wars.

Answered: 1 week ago