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. please send basic sample programs & explanatio
View Tutorial          By: rose at 2013-01-16 04:43:38

2. Thank ... for idea But
i m confuse how run

View Tutorial          By: Tanaji at 2010-06-01 23:13:19

3. Hi guys.i have a simple doubt.
i want to ru

View Tutorial          By: Muthukumar at 2011-12-29 07:30:56

4. I came to know about the basic concepts here but I
View Tutorial          By: Amit Gorvadiya at 2015-09-23 06:18:37

5. Very well Explained Thank you Hog .
View Tutorial          By: Asad at 2010-08-10 23:59:29

6. this is the thread object and thread name
View Tutorial          By: narain at 2011-12-06 07:33:07

7. can u please send me the code for sending sms from
View Tutorial          By: Vicky at 2008-03-20 02:34:27

8. This is very good article.
View Tutorial          By: Vipin Joshi at 2008-03-27 13:53:26

9. hello
i have a final studie project that sp

View Tutorial          By: samer at 2011-08-18 07:39:25

10. Great article. The simple example used easily make
View Tutorial          By: Nikhil at 2009-11-13 08:38:41