radit 0 Report post Posted October 1, 2004 salam knalnama saya adit saya dari jakartatolong bantu saya ya..saya lagi mencoba belajar c++tolong ya beri contoh program c++ absensi karyawanterima kasih buat teman-teman semuathx & regardsaditia mahendra Quote Share this post Link to post Share on other sites
encik pot pet 0 Report post Posted October 1, 2004 salam kenal utk adityasaya tidaklah dapat memahami apa itu "absensi karyawan"barangkali aditya dapat menterjemahkan(translate) kepada bahasa inggeris (english)cya Quote Share this post Link to post Share on other sites
radit 0 Report post Posted October 4, 2004 absensi karyawan = employee presentation record Quote Share this post Link to post Share on other sites
BudakCumpung 0 Report post Posted October 4, 2004 adakah absensi karyawan itu sama dengan catatan rekod kedatangan pekerja..? tau rekod prestasi pekerja atau rekod bla..bla..bla..?aku tak paham lagi ni... macamana nak tolong..dan lagi satu... no offense.. heheheh.. kang jadi international political issue plak..mungkinkah atau adakah setiap negara akan ada segelintir pelajar yang lebih suka disuapkan daripada mengangkat tangan sendiri dan menyuapkan ke dalam mulut sendiri... yaperdaaa aku cakap... Quote Share this post Link to post Share on other sites
radit 0 Report post Posted October 7, 2004 rekod kedatangan pekerja Quote Share this post Link to post Share on other sites
zerocool 0 Report post Posted October 7, 2004 (edited) Nak senang guna C++ Builder....Sehari pun leh siap kalau dah ada DB...utk yg ringkas je la Edited October 7, 2004 by zerocool Quote Share this post Link to post Share on other sites
BudakCumpung 0 Report post Posted October 7, 2004 (edited) code taken from PSC written by Bagus Adiyanto Dobmungkin boleh membantu/************************************** //   //INCLUDE files for :Employee Informatio //   n Package //************************************** //   struct Employee   {   int id;   char firstname[30];   char address[50];   float hoursworked;   float wage; }; class Data   {   public:    Data();    void AddRecord();    void DelRecord();    void PrintPayStubs();    void CreateFile();   void ViewRecord();   private:    void ReadFromFile(Employee[]);    int SearchEmptyRecord(Employee[]);    void WriteToFile(Employee[]);    int Search(Employee[],int);    float CountedGrossPay(float,float);    float CountedTotalTax(float);    float CountedNetPay(float,float);    void ShowRecord(Employee[],int);    Employee record[11];    float FederalTaxRate;    float StateTaxRate;    float GrossPay;    float TotalTaxAmount,NetPay; }; Data::Data()//constructor   {   for(int i=0;i<11;i++)     {      record[i].id=0;      strcpy(record[i].firstname," ");      strcpy(record[i].address," ");      record[i].hoursworked=0.0;      record[i].wage=0.0;     }     FederalTaxRate=0.15; //this tax rate is only assumption     StateTaxRate=0.05;   }   void Data::CreateFile() //this class implementation is only used when the first     {     //time i run the program to create file     ofstream fout("A:\data.txt",ios::out);     for(int i=0;i<11;i++)       {        fout<<record[i].id<<"\t";        fout<<record[i].firstname<<"\t";        fout<<record[i].address<<"\t";        fout<<record[i].hoursworked<<"\t";        fout<<record[i].wage<<"\n";       }       fout.close();     }     void Data::AddRecord() //to add record to the blank record       {       int location;       char ans;       ReadFromFile(record);       do         {          clrscr();          location=SearchEmptyRecord(record); //to find empty record          if (location==-1)            {             cout<<"You have reached maximum capacity\n";            }            else              {              gotoxy(14,10);cout<<"enter employee id : "<<(location+1)<<"\n";              record[location].id=(location+1);//to assign customer id automatically              cin.ignore();              gotoxy(14,11);cout<<"enter employee first name : ";              cin.get(record[location].firstname,30);              cin.ignore();              gotoxy(14,12);cout<<"enter employee address: ";              cin.get(record[location].address,40);              gotoxy(14,13);cout<<"enter employee hours : ";              cin>>record[location].hoursworked;              gotoxy(14,14);cout<<"enter employee wage: ";              cin>>record[location].wage;              WriteToFile(record);              }              gotoxy(14,15);cout<<"do you want to add record again : ";              cin>>ans;             }while(ans=='y'||ans=='Y');           }           void Data::ReadFromFile(Employee a[])//to read the data from the file and assign them to             {//variable             ifstream fin("A:\data.txt",ios::in);             for(int i=0;(!fin.eof()&&i<11);i++)               {                fin>>a[i].id;                fin.ignore();                fin.getline(a[i].firstname,(strlen(a[i].firstname)+1));                fin.ignore();                fin.getline(a[i].address,(strlen(a[i].address)+1));                fin>>a[i].hoursworked;                fin>>a[i].wage;               }               fin.close();             }             int Data::SearchEmptyRecord(Employee a[])               {               int i=0;               while(i<11)                 {                  if(a[i].id==0)//if customer id equal to zero it means the record is empty                  return i;                  else                  i++;                 }                 return -1;               }               void Data::WriteToFile(Employee a[])//to write the data hold in variable to the file                 {                 ofstream fout;                 fout.open("A:\data.txt",ios::out);                 for(int i=0;i<11;i++)                   {                    fout<<a[i].id<<"\t";                    fout<<a[i].firstname<<"\t";                    fout<<a[i].address<<"\t";                    fout<<a[i].hoursworked<<"\t";                    fout<<a[i].wage<<"\n";                   }                   fout.close();                 }                 void Data::ViewRecord()//to view certain record with using customer id as primary key                   {                   int key,location;                   ReadFromFile(record);                   gotoxy(14,9);cout<<"Enter employee # id number that you want to see : ";                   cin>>key;                   location=Search(record,key);                   if (location==-1)                     {                      gotoxy(14,10);cout<<"Record not found\n";                     }                     else                      ShowRecord(record,location);                   }                   int Data::Search(Employee a[],int target)//to find certain record in array with using linear search                     {                     int i=0;                     while(i<11)                       {                        if (a[i].id==target)                        return i;                        else                        i++;                       }                       return -1;                     }                     void Data::DelRecord()                       {                       char ans;                       int key,location;                       ReadFromFile(record);                       gotoxy(14,9);cout<<"Enter employee # id that you want to delete : ";                       cin>>key;                       location=Search(record,key);                       if (location==-1)                         {                          gotoxy(14,10);cout<<"Record not found";                         }                         else                           {                            ShowRecord(record,location);                            gotoxy(14,15);cout<<"Are you sure you want to delete this record(y/n) : ";                            cin>>ans;                            if (ans=='y'||ans=='Y')                              {                              record[location].id=0;                              strcpy(record[location].firstname," ");                              strcpy(record[location].address," ");                              record[location].hoursworked=0.0;                              record[location].wage=0.0;                              WriteToFile(record);                              }                             }                           }                           void Data::PrintPayStubs()                             {                             int key,location;                             ReadFromFile(record);                             gotoxy(14,9);cout<<"Enter employee # id number: ";                             cin>>key;                             location=Search(record,key);                             if (location==-1)                              cout<<"Record not found";                             else                               {                                GrossPay=CountedGrossPay(record[location].wage,record[location].hoursworked);                                TotalTaxAmount=CountedTotalTax(GrossPay);                                NetPay=CountedNetPay(GrossPay,TotalTaxAmount);                                gotoxy(14,10); cout<<"****************WEEKLY PAY STUBS*******************\n";                                gotoxy(14,11); cout<<"Employee name\t\t: "<<record[location].firstname<<endl;                                gotoxy(14,12); cout<<"Employee address\t: "<<record[location].address<<endl;                                gotoxy(14,13); cout<<"Gross Pay\t\t: "<<"$ "<<GrossPay<<endl;                                gotoxy(14,14); cout<<"Tax Withheld\t\t: "<<"$ "<<TotalTaxAmount<<endl;                                gotoxy(14,15); cout<<"NetPay\t\t\t: "<<"$ "<<NetPay<<endl;                                gotoxy(14,16); cout<<"Employee wage\t\t: "<<"$ "<<record[location].wage<<endl;                                gotoxy(14,17); cout<<"***************************************************\n";                               }                             }                             float Data::CountedGrossPay(float Wage,float Hours)                               {                               if (Hours>40)                                 {                                  return((40*Wage)+((Hours-40)*Wage*1.5));                                 }                                 else                                  return(40*Wage);                               }                               float Data::CountedTotalTax(float GrossPay)                                 {                                 return(GrossPay*(FederalTaxRate+StateTaxRate));                               }                               float Data::CountedNetPay(float GrossPay,float TaxAmount)                                 {                                 return(GrossPay-TaxAmount);                               }                               void Data::ShowRecord(Employee a[],int location)                                 {                                 gotoxy(14,10);cout<<"Employee id : "<<a[location].id<<endl;                                 gotoxy(14,11);cout<<"Employee name: "<<a[location].firstname<<endl;                                 gotoxy(14,12);cout<<"Employee address : "<<a[location].address<<endl;                                 gotoxy(14,13);cout<<"Employee hours: "<<a[location].hoursworked<<endl;                                 gotoxy(14,14);cout<<"Employee wage: "<<a[location].wage<<endl;                               }JANGAN MALAS Edited October 7, 2004 by BudakCumpung Quote Share this post Link to post Share on other sites
radit 0 Report post Posted October 11, 2004 hi budak cumpungthanks ya..btw where's the main program? Quote Share this post Link to post Share on other sites
alternat0r 0 Report post Posted October 11, 2004 code taken from PSC written by Bagus Adiyanto DobI think you (radit) might search the code on PSC ... 'BudakCumpung' already giving a hint ... Quote Share this post Link to post Share on other sites
BudakCumpung 0 Report post Posted October 11, 2004 hehhehe.. thanks alternator... baru nak jawap benda yang sama tadi.. Quote Share this post Link to post Share on other sites