Comment on Tutorial - do...while Loops in C++ By Abinaya



Comment Added by : Joshua Torres

Comment Added at : 2012-10-05 16:59:17

Comment on Tutorial : do...while Loops in C++ By Abinaya
/
//BSIT
//
#include<iostream.h>
#include<conio.h>
void main()
{ clrscr();
double rPay,oPay,tax,nPay,pRate,hrswrkd,otPay,gPay,quit=0,total=0,total1=0,total2=0;
int noOfemployees=0;
char eCode,lCode,choice;
do{
cout<<"Enter the payrate: ";
cin>>pRate;
cout<<"Enter the number of hours worked: ";
cin>>hrswrkd;
cout<<"Enter the employee code (A or B): ";
cin>>eCode;
cout<<"Enter the location code (N or P): ";
cin>>lCode;
cout<<endl;
noOfemployees++;
total+=gPay+gPay;
total1+=nPay+nPay;
total2+=tax+tax;
if(hrswrkd<=40)
{rPay=pRate*hrswrkd;
otPay=0; }
else if (hrswrkd>40)
{rPay=pRate*40;
otPay=(1.5*pRate)*(hrswrkd-40);}
cout<<"Regular Pay: "<<rPay<<endl;
cout<<"Overtime Pay: "<<otPay<<endl;
gPay=rPay+otPay;
cout<<"Gross Pay: "<<gPay<<endl;
if(eCode=='A'&&lCode=='N')
tax=gPay*0.07;
else if(eCode=='A'&&lCode!='N')
tax=gPay*0.045;
else if(eCode!='A')
tax=0;
cout<<"Tax: "<<tax<<endl;
cout<<"---------------------"<<endl;
nPay=gPay-tax;
cout<<"Net pay: "<<nPay<<endl;
cout<<endl;
cout<<"Do you want to process another employee? (y/n): "<<endl;
cin>>choice;
if(choice!='y')
quit=0;
}while(choice!='n');
quit=1;

cout<<"Total number of employees processed:"<<noOfemployees<<endl;
cout<<"Total gross pay:"<<total<<endl;
cout<<"Total Tax:"<<total2<<endl;
cout<<"Total net pay:"<<total1<<endl;
getch();
}

i need to know the formula of TOTAL please help me


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. nice one example !!!!.....
View Tutorial          By: santanu at 2011-02-09 22:54:54

2. Your Crystal report viewer showing all the records
View Tutorial          By: Neel at 2013-06-09 15:02:15

3. nice tutorial
View Tutorial          By: Raman at 2014-11-13 07:47:11

4. <uses-permission android:name="android.per
View Tutorial          By: Dev at 2012-04-06 06:19:03

5. Thank you a lot for sharing your knowledge! It was
View Tutorial          By: Marcelo at 2013-01-17 03:07:37

6. thanks
View Tutorial          By: snooker at 2013-02-04 19:45:40

7. very good example....but not explained well, begin
View Tutorial          By: ashish at 2012-06-06 17:34:57

8. It is an excellent article. Please keep up the goo
View Tutorial          By: sanjay at 2011-03-09 03:17:45

9. Thanks, cleared the situation!!
View Tutorial          By: alex at 2010-03-23 16:16:49

10. it works well thanks
View Tutorial          By: Zahran at 2011-12-08 03:07:07