fork download
  1. //*******************************************************
  2. //Homework 1 - Simple Employee Pay Program
  3. //
  4. //Name: Barbara Chop
  5. //
  6. //Class: C Programming, Spring 2025
  7. //
  8. //Date: 09/11/2025
  9. //
  10. //Description: Write a C program that will calculate the pay for employees.
  11. //
  12. //*******************************************************
  13.  
  14. #include <stdio.h>
  15. int main()
  16. {
  17. int clockNumber; //Employee clock number
  18. float gross; //Gross weekly pay (wage + hours)
  19. float hours; //weekly hours worked
  20. float wageRate; //Hourly wage
  21.  
  22. printf ("\n\t*** Pay Calculator ***\n");
  23.  
  24. //Prompt for input values from the screen
  25. printf ("\n\tEnter Employee's Clock #: ");
  26. scanf ("%d", &clockNumber);
  27. printf ("\n\tEnter hourly wage: ");
  28. scanf ("%f", &wageRate);
  29. printf ("\n\tEnter number of hours worked: ");
  30. scanf ("%f", &hours);
  31.  
  32. //Calculate gross pay
  33. gross = wageRate * hours;
  34.  
  35. //Print out employee information
  36. printf ("\n\n\t----------------------------------------------------------\n");
  37. printf ("\tClock # Wage Hours Gross\n");
  38. printf ("\t----------------------------------------------------------\n");
  39.  
  40. printf ("\t%06i %5.2f %5.1f %7.2f\n", clockNumber, wageRate, hours, gross);
  41.  
  42. return (0); //end here
  43.  
  44. } //main
  45.  
Success #stdin #stdout 0s 5316KB
stdin
98401 25.00 80.0
stdout
	*** Pay Calculator ***

	Enter Employee's Clock #: 
	Enter hourly wage: 
	Enter number of hours worked: 

	----------------------------------------------------------
	Clock # Wage Hours Gross
	----------------------------------------------------------
	098401 25.00  80.0 2000.00