fork download
  1. //*******************************************************
  2. //
  3. // Homework: 1
  4. //
  5. // Name: Robert Richard
  6. //
  7. // Class: C Programming, Spring 2023
  8. //
  9. // Date: 1/26/23
  10. //
  11. // Description: Program which determines gross pay and outputs
  12. // be sent to a designated file. This version does not use file pointers
  13. //
  14. //
  15. //********************************************************
  16.  
  17. #include <stdio.h>
  18. int main()
  19. {
  20. int clockNum; /* employee clock number */
  21. float grossPay; /* gross pay for week (wage * hours) */
  22. float hoursWorked; /* number of hours worked per week */
  23. float hourlyWage; /* hourly wage */
  24. printf ("This is a program to calculate gross pay.\n");
  25. printf ("You will be prompted for employee data.\n\n");
  26. printf ("Enter clock number for employee: ");
  27. scanf ("%d", &clockNum);
  28. printf ("Enter hourly wage for employee: ");
  29. scanf ("%f", &hourlyWage);
  30. printf ("Enter the number of hours the employee worked: ");
  31. scanf ("%f", &hoursWorked);
  32.  
  33. grossPay = hourlyWage * hoursWorked;
  34.  
  35. printf ("\n\t\tC Programming, First Homework Assignment\n\n\n");
  36. printf ("\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",
  41. clockNum, hourlyWage, hoursWorked, grossPay);
  42. return 0;
  43. }
  44.  
Success #stdin #stdout 0s 5400KB
stdin
526488
9.75
42.5
stdout
This is a program to calculate gross pay.
You will be prompted for employee data.

Enter clock number for employee: Enter hourly wage for employee: Enter the number of hours the employee worked: 
		C Programming, First Homework Assignment


	----------------------------------------------------------
	Clock # Wage Hours Gross
	----------------------------------------------------------
	526488  9.75  42.5  414.38