irwan94

class BSI

Dec 9th, 2015
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. #include <conio>
  2. #include <iostream>
  3. #include <stdio>
  4.  
  5. class pegawai
  6. {
  7. public:
  8. void NP()//NP=Nama Perusahaan
  9. {
  10. cout<<"\t\tPT. MERIANG GEMBIRA"<<endl;
  11. }
  12. void garis()
  13. {
  14. cout<<"-----------------------------------------"<<endl;
  15. }
  16. int jum,jumhonor,harilem,totalem,tothonor;
  17. char TGL[20],nama[20];
  18. double honor(int b);
  19. double asu(double c,int d);//c*d
  20.  
  21. };
  22.  
  23. double pegawai::honor(int b)
  24. {
  25. return(b)*3125;
  26. }
  27. double pegawai::asu(double c,int d)
  28. {
  29. return(c+d);
  30. }
  31.  
  32.  
  33. void main()
  34. {
  35. int a, x=0,totalall[20]={0};
  36. pegawai title;//ngambil dari class
  37. pegawai PG,PE[20];
  38.  
  39. title.NP();
  40. title.garis();
  41. cout<<"JUMLAH\t:";cin>>PG.jum;
  42. cout<<"TANGGAL INPUT :";gets(PG.TGL);
  43. //PE[a].tothonor=0;
  44.  
  45. for(a=1;a<=PG.jum;a++)
  46. {
  47. cout<<"DATA KE\t:"<<a<<endl;
  48. cout<<"NAMA PEGAWAI:";cin>>PE[a].nama;
  49. cout<<"JUMLAH JAM KERJA:";cin>>PE[a].jum;
  50. PE[a].jumhonor=PE[a].honor(PE[a].jum);
  51. if(PE[a].jum>8)
  52. {
  53. PE[a].harilem=PE[a].jum-8;
  54. PE[a].totalem=PE[a].harilem*1500;
  55. }
  56. else
  57. PE[a].totalem=0;
  58.  
  59. PE[a].tothonor=PE[a].asu(PE[a].jumhonor,PE[a].totalem);
  60. totalall[x]=totalall[x]+PE[a].asu(PE[a].jumhonor,PE[a].totalem);
  61.  
  62.  
  63. }
  64.  
  65. clrscr();
  66. title.NP();
  67. title.garis();
  68. cout<<"TANGGAL\t:"<<PG.TGL<<endl;
  69. title.garis();
  70. cout<<"No.\tNama\tHonor\tJumlah\t\tHonor\tTotal"<<endl;
  71. cout<<"\tPegawai\t\tJam Kerja\tLembur\tHonor"<<endl;
  72. for(a=1;a<=PG.jum;a++)
  73. {
  74. cout<<a;
  75. cout<<"\t"<<PE[a].nama;
  76. cout<<"\t"<<PE[a].jumhonor;
  77. cout<<"\t"<<PE[a].jum;
  78. cout<<"\t\t"<<PE[a].totalem;
  79. cout<<"\t"<<PE[a].tothonor;
  80.  
  81.  
  82. cout<<endl;
  83. }
  84. title.garis();
  85. cout<<"TOTAL HONOR PEGAWAI SEBESAR\t\t\t"<<totalall[x];
  86.  
  87. getch();
  88. }
Advertisement
Add Comment
Please, Sign In to add comment