ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 04 May 2017 My Price 8.00

set pay rate as per the choice

Could you please run the program and send me a screen shot ?

 

 

#include<stdio.h>
#define
#define
#define
#define
#define
#define
#define
#define PAY_RATE_1 8.75f
PAY_RATE_2 9.33f
PAY_RATE_3 10.00f
PAY_RATE_4 11.20f
TAX_RATE_FIRST_300 0.15f
TAX_RATE_NEXT_150 0.20f
TAX_RATE_REST 0.25f
OVERTIME_RATE 1.5f int main()
{
int choice;
int hoursWorked;
float payRate;
float grossPay;
float taxes;
float netPay;
float overtimePay = 0;
printf("******************************************************************\n\n")
;
printf("Enter the number corresponding to the desired pay rate or
action:\n\n");
printf("1) $8.75/hr\t\t\t\t2) $9.33/hr\n\n");
printf("3) $10.00/hr\t\t\t\t4) $11.20/hr\n\n");
printf("5) quit\n\n");
printf("******************************************************************\n\n")
;
scanf("%d", &choice);
// if entered choice is invalid, recycle
while(choice < 1 || choice > 5)
{
printf("\nWrong choice! Please select correct option\n\n");
printf("******************************************************************\n\n")
;
printf("Enter the number corresponding to the desired pay rate or
action:\n\n");
printf("1) $8.75/hr\t\t\t\t2) $9.33/hr\n\n");
printf("3) $10.00/hr\t\t\t\t4) $11.20/hr\n\n");
printf("5) quit\n\n");
printf("******************************************************************\n\n")
;
} scanf("%d", &choice); // ask for hours worked
printf("\nPlease enter the number of hours worked: ");
scanf("%d", &hoursWorked);
// set pay rate as per the choice
switch(choice)
{
case 1:
payRate = PAY_RATE_1;
break;
case 2: payRate = PAY_RATE_2;
break;
case 3:
payRate = PAY_RATE_3;
break;
case 4:
payRate = PAY_RATE_4;
break;
case 5:
return 0;
}
// check if overtime and gross pay
if(hoursWorked > 40)
{
overtimePay = (hoursWorked - 40) * payRate * OVERTIME_RATE;
grossPay = (40 * payRate) + overtimePay;
}
else
{
grossPay = hoursWorked * payRate;
}
// calculate taxes
if(grossPay <= 300)
taxes = grossPay * TAX_RATE_FIRST_300;
else if(grossPay <= 450)
taxes = grossPay * TAX_RATE_NEXT_150;
else
taxes = grossPay * TAX_RATE_REST;
// calculate net pay
netPay = grossPay - taxes;
// display gross pay, taxes and net pay
printf("\n\nGross Pay: $%.2f", grossPay);
printf("\nTaxes: $%.2f", taxes);
printf("\nNet Pay: $%.2f", netPay);
return 0;
}

Answers

(11)
Status NEW Posted 04 May 2017 05:05 AM My Price 8.00

-----------

Attachments

file 1493878647-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)