//*******************************************************
//
// Homework: 1 (Chapter 4/5)
//
// Name: <Damian Uhomoibhi>
//
// Class: C Programming, <Fall 2024>
//
// Date: <15 September 2024>
//
// Description: Program which determines gross pay and outputs
// to the screen. This version does not use file pointers
//
// Non file pointer solution
//
//********************************************************
#include <stdio.h>
int main ( )
{
int clockNumber; // employee clock number
float gross; // gross pay for week (wage * hours)
float hours; // number of hours worked per week
float wageRate; // hourly wage
printf ( "\n \t *** Pay Calculator ***\n " ) ;
// Prompt for input values from the screen
printf ( "\n \t Enter clock number for employee: " ) ; scanf ( "%d" , & clockNumber
) ; printf ( "\n \t Enter hourly wage for employee: " ) ; printf ( "\n \t Enter the number of hours the employee worked: " ) ;
// calculate gross pay
gross = wageRate * hours;
// print out employee information
printf ( "\n \n \t ----------------------------------------------------------\n " ) ; printf ( "\t Clock # Wage Hours Gross\n " ) ; printf ( "\t ----------------------------------------------------------\n " ) ;
printf ( "\t %06i %5.2f %5.1f %7.2f\n " , clockNumber
, wageRate
, hours
, gross
) ;
return ( 0 ) ; // success
} // main
Ly8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqIAovLyAKLy8gSG9tZXdvcms6IDEgKENoYXB0ZXIgNC81KSAKLy8gCi8vIE5hbWU6IDxEYW1pYW4gVWhvbW9pYmhpPiAKLy8gCi8vIENsYXNzOiBDIFByb2dyYW1taW5nLCA8RmFsbCAyMDI0PgovLyAKLy8gRGF0ZTogPDE1IFNlcHRlbWJlciAyMDI0PiAKLy8gCi8vIERlc2NyaXB0aW9uOiBQcm9ncmFtIHdoaWNoIGRldGVybWluZXMgZ3Jvc3MgcGF5IGFuZCBvdXRwdXRzIAovLyB0byB0aGUgc2NyZWVuLiAgIFRoaXMgdmVyc2lvbiBkb2VzIG5vdCB1c2UgZmlsZSBwb2ludGVycwovLwovLyBOb24gZmlsZSBwb2ludGVyIHNvbHV0aW9uIAovLyAKLy8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKio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