//*******************************************************
//
// Homework: 1 (Chapter 4/5)
//
// Name: Jett Chapman
//
// Class: C Programming, Fall 2024
//
// Date: September 11, 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: 127615" ) ; scanf ( "%d" , & clockNumber
) ; printf ( "\n \t Enter hourly wage for employee: 8.35" ) ; printf ( "\n \t Enter the number of hours the employee worked: 0.0" ) ;
// 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
Ly8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqIAovLyAKLy8gSG9tZXdvcms6IDEgKENoYXB0ZXIgNC81KSAKLy8gCi8vIE5hbWU6IEpldHQgQ2hhcG1hbgovLyAKLy8gQ2xhc3M6IEMgUHJvZ3JhbW1pbmcsIEZhbGwgMjAyNAovLyAKLy8gRGF0ZTogU2VwdGVtYmVyIDExLCAyMDI0Ci8vIAovLyBEZXNjcmlwdGlvbjogUHJvZ3JhbSB3aGljaCBkZXRlcm1pbmVzIGdyb3NzIHBheSBhbmQgb3V0cHV0cyAKLy8gdG8gdGhlIHNjcmVlbi4gICBUaGlzIHZlcnNpb24gZG9lcyBub3QgdXNlIGZpbGUgcG9pbnRlcnMKLy8KLy8gTm9uIGZpbGUgcG9pbnRlciBzb2x1dGlvbiAKLy8gCi8vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqK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