To use a sentinel loop so once the value of -99 i

Assignment Help C/C++ Programming
Reference no: EM13165534

modify this program to use a sentinal loop so once the value of -99 is entered after getting the pay and hours the program should end.  get this to work. It works without the if statement but not with it.

 

#include <stdio.h>
#define SENTINAL -99
int
main (void)
{

    double     total_pay;        //company payroll
    int     count_emp;        //current employees
    int        number_emp;        //number of employees
    double     hours;            //hours worked
    double     rate;            //hourly rate
    double     pay;            // pay for period

    /* Get number of employeed. */
    printf ("Enter total number of employees> ");
    scanf("%d", &number_emp);
   
    /* Compute each employees pay and add it to the payroll*/
    total_pay = 0.0;
    count_emp = 0;
   
   
   
    while (count_emp < number_emp)
    {
        printf ("Hours> ");
        scanf ("%lf", &hours);
        printf ("rate> ");
        scanf ("%lf", &rate);
       
        if (hours != SENTINAL){
        pay = hours * rate;
        printf("Pay is $%6.2f\n\n",pay);
        total_pay = total_pay + pay;
        count_emp = count_emp + 1;
        }
    }
   
    printf ("All employees processed \n");
    printf ("Total payroll is $%8.2f\n", total_pay);
   
return (0);   
}

 

 

Reference no: EM13165534

Questions Cloud

What will be the mass of the remaining nicl2 : A 6.269 g sample of NiCl2·2H2O is heated until all the water of hydration is removed. What will be the mass of the remaining NiCl2?
How many moles of h2o are needed : If 32.0 g CaC2 are consumed in this reaction, how many moles of H2O are needed?
Define and use ice table and henderson-hasselbach equation : Use ICE table and henderson-hasselbach equation to calculate pH of BUFFER A after your particular volume of acid was added to achieve pH change of 1.0.
What is the value of x in product formula : when 3.299 of iodine reacts with fluorine, 5.768g of IFx is formed. What is the value of x in product formula (IFx)?"
To use a sentinel loop so once the value of -99 i : modify this program to use a sentinal loop so once the value of -99 is entered after getting the pay and hours the program should end.
Consider the reaction of the pairs of these compounds : Solutions of strontium hydroxide, silver nitrate, hydrogen phosphate, potassium nitrate, and copper (II) sulphate are prepared and placed in separate containers. Consider the reaction of the pairs of these compounds.
Which type of bond has one pair of electrons shared : which type of bond has one pair of electrons shared between atoms? a) single covalent b) coordinate covalent c) double covalent d) metallic
Explain what concentration of nh : what concentration of NH4+ must be present in a 0.20M aqueous ammonia solution to prevent the percipitation of Mg(OH)2 if the ammonia solution
State what mass of the corresponding sodium salt : Which of the acids in question #3 would be the best choice to create a buffer with pH = 7.35? If you had 250.0 mL of a 0.20 M solution of the acid, what mass of the corresponding sodium salt of the conjugate base would be required to make the buff..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd