fork download
  1. #include <stdio.h>
  2. int main ()
  3. {
  4.  
  5. int clockNumber; // employee clock number
  6. float gross; // gross pay for week (wage * hours)
  7. float hours; // number of hours worked per week
  8. float wageRate; // hourly wage
  9.  
  10. printf ("\n\t*** Pay Calculator ***\n");
  11.  
  12. // Prompt for input values from the screen
  13. printf ("\n\tEnter clock number for employee: 98401");
  14. scanf ("%d", &clockNumber);
  15. printf ("\n\tEnter hourly wage for employee: 10.60 ");
  16. scanf ("%f", &wageRate);
  17. printf ("\n\tEnter the number of hours the employee worked: 51.0 ");
  18. scanf ("%f", &hours);
  19.  
  20. // calculate gross pay
  21. gross = wageRate * hours;
  22.  
  23. // print out employee information
  24. printf ("\n\n\t----------------------------------------------------------\n");
  25. printf ("\tClock # Wage Hours Gross\n");
  26. printf ("\t----------------------------------------------------------\n");
  27.  
  28. printf ("\t%06i %5.2f %5.1f %7.2f\n", clockNumber, wageRate, hours, gross);
  29.  
  30.  
  31.  
  32. int clockNumberTwo; // employee clock number
  33. float grossTwo; // gross pay for week (wage * hours)
  34. float hoursTwo; // number of hours worked per week
  35. float wageRateTwo; // hourly wage
  36.  
  37. printf ("\n\t*** Pay Calculator ***\n");
  38.  
  39. // Prompt for input values from the screen
  40. printf ("\n\tEnter clock number for employee: 526488");
  41. scanf ("%d", &clockNumberTwo);
  42. printf ("\n\tEnter hourly wage for employee: 9.75 ");
  43. scanf ("%f", &wageRateTwo);
  44. printf ("\n\tEnter the number of hours the employee worked: 42.5 ");
  45. scanf ("%f", &hoursTwo);
  46.  
  47. // calculate gross pay
  48. grossTwo = wageRateTwo * hoursTwo;
  49.  
  50. // print out employee information
  51. printf ("\n\n\t----------------------------------------------------------\n");
  52. printf ("\tClock # Wage Hours Gross\n");
  53. printf ("\t----------------------------------------------------------\n");
  54.  
  55. printf ("\t%06i %5.2f %5.1f %7.2f\n", clockNumberTwo, wageRateTwo, hoursTwo, grossTwo);
  56.  
  57.  
  58. int clockNumberThree; // employee clock number
  59. float grossThree; // gross pay for week (wage * hours)
  60. float hoursThree; // number of hours worked per week
  61. float wageRateThree; // hourly wage
  62.  
  63. printf ("\n\t*** Pay Calculator ***\n");
  64.  
  65. // Prompt for input values from the screen
  66. printf ("\n\tEnter clock number for employee: 765349");
  67. scanf ("%d", &clockNumberThree);
  68. printf ("\n\tEnter hourly wage for employee: 10.50 ");
  69. scanf ("%f", &wageRateThree);
  70. printf ("\n\tEnter the number of hours the employee worked: 37.0 ");
  71. scanf ("%f", &hoursThree);
  72.  
  73. // calculate gross pay
  74. grossThree = wageRateThree * hoursThree;
  75.  
  76. // print out employee information
  77. printf ("\n\n\t----------------------------------------------------------\n");
  78. printf ("\tClock # Wage Hours Gross\n");
  79. printf ("\t----------------------------------------------------------\n");
  80.  
  81. printf ("\t%06i %5.2f %5.1f %7.2f\n", clockNumberThree, wageRateThree, hoursThree, grossThree);
  82.  
  83.  
  84. int clockNumberFour; // employee clock number
  85. float grossFour; // gross pay for week (wage * hours)
  86. float hoursFour; // number of hours worked per week
  87. float wageRateFour; // hourly wage
  88.  
  89. printf ("\n\t*** Pay Calculator ***\n");
  90.  
  91. // Prompt for input values from the screen
  92. printf ("\n\tEnter clock number for employee: 34645");
  93. scanf ("%d", &clockNumberFour);
  94. printf ("\n\tEnter hourly wage for employee: 12.25 ");
  95. scanf ("%f", &wageRateFour);
  96. printf ("\n\tEnter the number of hours the employee worked: 45.0 ");
  97. scanf ("%f", &hoursFour);
  98.  
  99. // calculate gross pay
  100. grossFour = wageRateFour * hoursFour;
  101.  
  102. // print out employee information
  103. printf ("\n\n\t----------------------------------------------------------\n");
  104. printf ("\tClock # Wage Hours Gross\n");
  105. printf ("\t----------------------------------------------------------\n");
  106.  
  107. printf ("\t%06i %5.2f %5.1f %7.2f\n", clockNumberFour, wageRateFour, hoursFour, grossFour);
  108.  
  109.  
  110. int clockNumberFive; // employee clock number
  111. float grossFive; // gross pay for week (wage * hours)
  112. float hoursFive; // number of hours worked per week
  113. float wageRateFive; // hourly wage
  114.  
  115. printf ("\n\t*** Pay Calculator ***\n");
  116.  
  117. // Prompt for input values from the screen
  118. printf ("\n\tEnter clock number for employee: 127615");
  119. scanf ("%d", &clockNumberFive);
  120. printf ("\n\tEnter hourly wage for employee: 8.35 ");
  121. scanf ("%f", &wageRateFive);
  122. printf ("\n\tEnter the number of hours the employee worked: 0.0 ");
  123. scanf ("%f", &hoursFive);
  124.  
  125. // calculate gross pay
  126. grossFive = wageRateFive * hoursFive;
  127.  
  128. // print out employee information
  129. printf ("\n\n\t----------------------------------------------------------\n");
  130. printf ("\tClock # Wage Hours Gross\n");
  131. printf ("\t----------------------------------------------------------\n");
  132.  
  133. printf ("\t%06i %5.2f %5.1f %7.2f\n", clockNumberFive, wageRateFive, hoursFive, grossFive);
  134.  
  135. return (0); // success
  136. } // main
  137.  
Success #stdin #stdout 0s 5272KB
stdin
98401
10.60
51.0

526488
9.75
42.5

765349
10.50
37.0

34645
12.25
45.0

127615
8.35
0.0


stdout
	*** Pay Calculator ***

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

	----------------------------------------------------------
	Clock # Wage Hours Gross
	----------------------------------------------------------
	098401 10.60  51.0  540.60

	*** Pay Calculator ***

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

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

	*** Pay Calculator ***

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

	----------------------------------------------------------
	Clock # Wage Hours Gross
	----------------------------------------------------------
	765349 10.50  37.0  388.50

	*** Pay Calculator ***

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

	----------------------------------------------------------
	Clock # Wage Hours Gross
	----------------------------------------------------------
	034645 12.25  45.0  551.25

	*** Pay Calculator ***

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

	----------------------------------------------------------
	Clock # Wage Hours Gross
	----------------------------------------------------------
	127615  8.35   0.0    0.00