//*******************************************************
//
// Homework: 1 (Chapter 4/5)
//
// Name: Tim Ticknor
//
// Class: C Programming, Fall, 2024
//
// Date: 9/12/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
Ly8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqIAovLyAKLy8gSG9tZXdvcms6IDEgKENoYXB0ZXIgNC81KSAKLy8gCi8vIE5hbWU6IFRpbSBUaWNrbm9yIAovLyAKLy8gQ2xhc3M6IEMgUHJvZ3JhbW1pbmcsIEZhbGwsIDIwMjQKLy8gCi8vIERhdGU6IDkvMTIvMjAyNAovLyAKLy8gRGVzY3JpcHRpb246IFByb2dyYW0gd2hpY2ggZGV0ZXJtaW5lcyBncm9zcyBwYXkgYW5kIG91dHB1dHMgCi8vIHRvIHRoZSBzY3JlZW4uICAgVGhpcyB2ZXJzaW9uIGRvZXMgbm90IHVzZSBmaWxlIHBvaW50ZXJzCi8vCi8vIE5vbiBmaWxlIHBvaW50ZXIgc29sdXRpb24gCi8vIAovLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKio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