Advertisement
colonel007-fps

Calculate Wage Value

Nov 5th, 2016
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.21 KB | None | 0 0
  1. //--============================================================================================================//
  2. //--====||||||||||||====||||||||||====|===========||||||||||=====|============|======|||||||||||=====|==========//
  3. //--====|===============|========|====|===========|========|=====|=\==========|======|===============|==========//
  4. //--====|===============|========|====|===========|========|=====|===\========|======|===============|==========//
  5. //--====|===============|========|====|===========|========|=====|====\=======|======|===============|==========//
  6. //--====|===============|========|====|===========|========|=====|=====\======|======|===============|==========//
  7. //--====|===============|========|====|===========|========|=====|=====\======|======|||||||||||=====|==========//
  8. //--====|===============|========|====|===========|========|=====|======\=====|======|===============|==========//
  9. //--====|===============|========|====|===========|========|=====|=======\====|======|===============|==========//
  10. //--====|===============|========|====|===========|========|=====|=======\====|======|===============|==========//
  11. //--====|===============|========|====|===========|========|=====|========\===|======|===============|==========//
  12. //--====||||||||||||====||||||||||====|||||||||===||||||||||=====|==========\=|======|||||||||||=====||||||||===//
  13. //--============================================================================================================//
  14. //--============================================================================================================//
  15. /*
  16. Code by : Promsurin Phutthammawong
  17. ID: 5910613313
  18. Task : Wage.c
  19. Date Submit : 7/11/2016
  20. */
  21.  
  22. //////////////--- Call header files --- /////////////
  23. #include <stdio.h> // Include standard input output function header
  24. #include <math.h> // Include math function header
  25.  
  26. ///////////////  Declare Functions //////////////////
  27. int         getHour(void);
  28. float       getRate(void);
  29. float       calculateWage(int hr,float r);
  30. // type //  name    // | Variable in function |
  31.  
  32.  
  33. // Main Code //
  34. int main()
  35. {
  36.     int hour = 0;       //Declare new variables
  37.     float rate = 0;     //Declare new variables
  38.     float wage = 0;     //Declare new variables        
  39.     hour = getHour();   //Get Value from function getHour
  40.     rate = getRate();   //Get Value from function getRate
  41.     wage = calculateWage(hour,rate);    //Get Value from function calculateWage
  42.     printf("Wage is = %.2f BAHT",wage);     //  Print wage
  43.     return 0;  
  44. }
  45.  
  46. /////// Function getHour ////////
  47. int getHour(void)
  48. {
  49.     int hours = 0; //Declare new temporary variables
  50.     printf("Enter Worked Hour : "); //  Print input
  51.     scanf("%d",&hours);         // Scanf input to hours
  52.     return hours;   //return variables of this function
  53. }
  54. //// End ...
  55.  
  56. /////// Function getRate ////////
  57. float getRate(void)
  58. {
  59.     float rates = 0;        //Declare new temporary variables
  60.     printf("Enter Rate Per Hour : ");   //  Print input
  61.     scanf("%f",&rates);         // Scanf input to rates
  62.     return rates; //return variables of this function
  63. }
  64. //// End ...
  65.  
  66. /////// Function calculateWage ////////
  67. float calculateWage(int hr,float r)
  68. {
  69.     float wages = (float)hr*r; //Declare new temporary variables
  70.     return wages; //return variables of this function
  71. }
  72. //// End ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement