fork download
  1. //*******************************************************
  2. //
  3. // Homework: 1 (Chapter 4/5)
  4. //
  5. // Name: Quron Wright
  6. //
  7. // Class: C Programming, Fall 2024
  8. //
  9. // Date: 7/15/2024
  10. //
  11. // Description: Program which determines gross pay and outputs
  12. // to the screen. This version does not use file pointers
  13. //
  14. // Non file pointer solution
  15. //
  16. //********************************************************
  17.  
  18. #include <stdio.h>
  19. int main ()
  20. {
  21.  
  22. int clockNumber; // employee clock number
  23. float gross; // gross pay for week (wage * hours)
  24. float hours; // number of hours worked per week
  25. float wageRate; // hourly wage
  26.  
  27. printf ("\n\t*** Pay Calculator ***\n");
  28.  
  29. // Prompt for input values from the screen
  30. printf ("\n\tEnter clock number for employee: ");
  31. scanf ("%d", &clockNumber);
  32. printf ("\n\tEnter hourly wage for employee: ");
  33. scanf ("%f", &wageRate);
  34. printf ("\n\tEnter the number of hours the employee worked: ");
  35. scanf ("%f", &hours);
  36.  
  37. // calculate gross pay
  38. gross = wageRate * hours;
  39.  
  40. // print out employee information
  41. printf ("\n\n\t----------------------------------------------------------\n");
  42. printf ("\tClock # Wage Hours Gross\n");
  43. printf ("\t----------------------------------------------------------\n");
  44.  
  45. printf ("\t%06i %5.2f %5.1f %7.2f\n", clockNumber, wageRate, hours, gross);
  46.  
  47. return (0); // success
  48.  
  49. } // main
Success #stdin #stdout 0s 5272KB
stdin
127615
8.35
0.0
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
	----------------------------------------------------------
	127615  8.35   0.0    0.00