//*******************************************************
//
// Homework: 1 (Chapter 4/5)
//
// Name: Rose Locarno
//
// Class: C Programming, Summer 2023
//
// Date: May 23 2023
//
// 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 clock_num; // employee clock number
float grossPay; // gross pay for week (wage * hours)
float hours; // number of hours worked per week
float wage; // 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" , & clock_num
) ; printf ( "\n \t Enter hourly wage for employee: " ) ; printf ( "\n \t Enter the number of hours the employee worked: " ) ;
// calculate gross pay
grossPay = wage * hours;
// print out employee information
printf ( "\n \n \t ----------------------------------------------------------\n " ) ; printf ( "\t Clock # Wage Hours GrossPay\n " ) ; printf ( "\t ----------------------------------------------------------\n " ) ;
printf ( "\t %06i %5.2f %5.1f %7.2f\n " , clock_num
, wage
, hours
, grossPay
) ;
return ( 0 ) ; // success
} // main
ICAgIC8vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAKICAgIC8vIAogICAgLy8gSG9tZXdvcms6IDEgKENoYXB0ZXIgNC81KSAKICAgIC8vIAogICAgLy8gTmFtZTogIFJvc2UgTG9jYXJubwogICAgLy8gCiAgICAvLyBDbGFzczogQyBQcm9ncmFtbWluZywgU3VtbWVyIDIwMjMKICAgIC8vIAogICAgLy8gRGF0ZTogTWF5IDIzIDIwMjMgCiAgICAvLyAKICAgIC8vIERlc2NyaXB0aW9uOiBQcm9ncmFtIHdoaWNoIGRldGVybWluZXMgZ3Jvc3MgcGF5IGFuZCBvdXRwdXRzIAogICAgLy8gdG8gdGhlIHNjcmVlbi4gICBUaGlzIHZlcnNpb24gZG9lcyBub3QgdXNlIGZpbGUgcG9pbnRlcnMKICAgIC8vCiAgICAvLyBOb24gZmlsZSBwb2ludGVyIHNvbHV0aW9uIAogICAgLy8gCiAgICAvLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqIAogICAgIAogICAgI2luY2x1ZGUgPHN0ZGlvLmg+ICAKICAgIGludCBtYWluICgpIAogICAgeyAKICAgICAKICAgICAgICBpbnQgY2xvY2tfbnVtOyAgIC8vIGVtcGxveWVlIGNsb2NrIG51bWJlciAKICAgICAgICBmbG9hdCBncm9zc1BheTsgICAgIC8vIGdyb3NzIHBheSBmb3Igd2VlayAod2FnZSAqIGhvdXJzKSAKICAgICAgICBmbG9hdCBob3VyczsgICAgIC8vIG51bWJlciBvZiBob3VycyB3b3JrZWQgcGVyIHdlZWsgCiAgICAgICAgZmxvYXQgd2FnZTsgICAgICAvLyBob3VybHkgd2FnZSAKICAgICAKICAgICAgICBwcmludGYgKCJcblx0KioqIFBheSBDYWxjdWxhdG9yICoqKlxuIik7CiAgICAgCiAgICAgICAgLy8gUHJvbXB0IGZvciBpbnB1dCB2YWx1ZXMgZnJvbSB0aGUgc2NyZWVuIAogICAgICAgIHByaW50ZiAoIlxuXHRFbnRlciBjbG9jayBudW1iZXIgZm9yIGVtcGxveWVlOiAiKTsgCiAgICAgICAgc2NhbmYgKCIlZCIsICZjbG9ja19udW0pOyAKICAgICAgICBwcmludGYgKCJcblx0RW50ZXIgaG91cmx5IHdhZ2UgZm9yIGVtcGxveWVlOiAiKTsgCiAgICAgICAgc2NhbmYgKCIlZiIsICZ3YWdlKTsgCiAgICAgICAgcHJpbnRmICgiXG5cdEVudGVyIHRoZSBudW1iZXIgb2YgaG91cnMgdGhlIGVtcGxveWVlIHdvcmtlZDogIik7IAogICAgICAgIHNjYW5mICgiJWYiLCAmaG91cnMpOyAKICAgICAKICAgICAgICAvLyBjYWxjdWxhdGUgZ3Jvc3MgcGF5CiAgICAgICAgZ3Jvc3NQYXkgPSB3YWdlICogaG91cnM7IAogICAgIAogICAgICAgIC8vIHByaW50IG91dCBlbXBsb3llZSBpbmZvcm1hdGlvbiAKIC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