fork(1) 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 clock number for employee: ");
  26. scanf ("%d", &clockNumber);
  27. printf ("\n\tEnter hourly wage for employee: ");
  28. scanf ("%f", &wageRate);
  29. printf ("\n\tEnter the number of hours the employee 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.1f %7.2f\n", clockNumber, wageRate, hours, gross);
  41.  
  42. return (0); //end here
  43.  
  44. } //main
  45.  
Success #stdin #stdout 0.01s 5304KB
stdin
Standard input is empty
stdout
	*** Pay Calculator ***

	Enter clock number for employee: 
	Enter hourly wage for employee: 
	Enter the number of hours the employee worked: 

	----------------------------------------------------------
	Clock # Wage Hours Gross
	----------------------------------------------------------
	021940   0.0 149440512.00