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

  The program should support a ''new'' feature

Write a GUI program that represents a simple Notepad clone. The program should support a 'new' feature that clears the text buffer, a save feature that writes to a file using a PrintStream

  After the user presses any key

After the user presses any key, the board will be scrambled by making a large number of random moves (for a 3x3 puzzle, 100,000 attempted random moves in random directions will result in a sufficiently scrambled board)

  Program to generate 100,000 prime numbers

Write a POSIX C/C++ program to generate 100,000 prime numbers. Assume that the program will be run on a computer with 5 CPUs and that your goal is to have this program finish as quickly as possible.

  Program that will read in such an array

Write a program that will read in such an array, and repeatedly prints it so the user can select the direction in which to move next. The user's requested move can prompt a number of responses

  Program that can serve as a simple calculator

Write a program that can serve as a simple calculator. This calculator keeps track of a single number (of type double) that is called result and that starts out as 0.0. Each cycle allows the user to repeatedly add, subtract, multiply, or divide by..

  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.

  Calculate that implements a simple arithmetic calculator

Write a  C program  calc.c that implements a simple arithmetic calculator. Input to the calculator consists of lines composed of integer constants separated by the five arithmetic operators used in C: +, -, *, /, and %. For each line of input,

  The funtion should take as parameters

Write a function in c ++ that multiplies two functions. the funtion should take as parameters two fraction structures. Then, the function should multiply the two fractions and return the solution as a fraction structure.

  Maze program

Maze program. In this assignment you will represent a maze with a binary tree. . The starting point is node N and the ending point is node Z.

  Implement recursive algorithms using a stack

Show the difficulties of the added complexity and which of the two sorts is easier to implement nonrecursively? Why?

  Add 10 people to the line

Add 10 people to the line and process them. Each time you process someone, print out their ticket information. After all 10 have been serviced, print the average wait time. Below is an example of the time calls you will need and a wait function.

  Object oriented programming paradigm is better choice

Explain why object oriented programming paradigm is considered better choice than structured programming paradigm. Does it reflect our "natural" way of thinking or do you find it artificial?

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