The program below works perfectly. Edit the program below and make works without using this statement: if(hours==-1) Break; Make sure the program works perfect without the if statement. Use C language. Show your work in picture.
The program below works perfectly. Edit the program below and make works without using this statement: if(hours==-1) Break; Make sure the program works perfect without the if statement. Use C language. Show your work in picture.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
The program below works perfectly. Edit the program below and make works without using this statement: if(hours==-1)
Break;
Make sure the program works perfect without the if statement.
Use C language.
Show your work in picture.
![nt main(int argc, const char argv[]) {
/insert code here...
float hours=;// number with decimal point for hours
float rate; number with decimal point for rate
float salary; / number with decimal point for salary
float overtime; //
float overtimePay; // number with decimal point for overtimepay
number with decimal point for overtime
while (hours !=-1) {// loop while sentinel value not yet read from user
printf( "Enter number of hours worked (-1 to end): " ); // prompt for i
scanf( "%F", &hours ); // read hours from user
if (hours==-1) {
break;
printf( "Enter hourly rate of the worker ($00.00): "); // prompt input
scanf( "%f", &rate ) ; // read rate from user
salary = hours * rate; // hours times rate
if ( hours <= 40 ) // if hours less than or equal to 40,
printf( "Salary is $%.2f\n", salary ); // display salary
if ( hours > 40 ) {// if hours is larger than 40,
overtime = hours - 40; // subtract hours from 40
overtimePay = overtime * 0.5 * rate;// add salary to overtimepay
salary = salary + overtimePay;
printf( "Salary is $%.2f\n", salary )i // display salary
14
46
47
return 0;
48
49
OCT
28
tv](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F26f968ef-02cd-4e4c-bdf3-4916f95fcdb5%2Fc00f26fd-4de6-41f8-931e-64e7e946b5dd%2Fjopams6_processed.jpeg&w=3840&q=75)
Transcribed Image Text:nt main(int argc, const char argv[]) {
/insert code here...
float hours=;// number with decimal point for hours
float rate; number with decimal point for rate
float salary; / number with decimal point for salary
float overtime; //
float overtimePay; // number with decimal point for overtimepay
number with decimal point for overtime
while (hours !=-1) {// loop while sentinel value not yet read from user
printf( "Enter number of hours worked (-1 to end): " ); // prompt for i
scanf( "%F", &hours ); // read hours from user
if (hours==-1) {
break;
printf( "Enter hourly rate of the worker ($00.00): "); // prompt input
scanf( "%f", &rate ) ; // read rate from user
salary = hours * rate; // hours times rate
if ( hours <= 40 ) // if hours less than or equal to 40,
printf( "Salary is $%.2f\n", salary ); // display salary
if ( hours > 40 ) {// if hours is larger than 40,
overtime = hours - 40; // subtract hours from 40
overtimePay = overtime * 0.5 * rate;// add salary to overtimepay
salary = salary + overtimePay;
printf( "Salary is $%.2f\n", salary )i // display salary
14
46
47
return 0;
48
49
OCT
28
tv

Transcribed Image Text:Salary Calculator
Develop a program that will determine the gross pay for each of several employees. The
company pays "straight time" for the first 40 hours worked by each employee and pays
"time-and-a-half" for all hours worked in excess of 40 hours. You're given a list of the employees
of the company, the number of hours each employee worked last week and the hourly rate of
each employee. Your program should input this information for each employee, and should
determine and display the employee's gross pay.
Here is a sample input/output dialog:
Enter # of hours worked (-1 to end): 39
Enter hourly rate of the worker ($00.00): 10.00
Salary is $390.00
Enter # of hours worked (-1 to end): 40
Enter hourly rate of the worker ($00.00): 10.00
Salary is $400.00
Enter # of hours worked (-1 to end): 41
Enter hourly rate of the worker ($00.00): 10.00
Salary is $415.00
Enter # of hours worked (-1 to end): -1
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY