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. Hiiii Al, I am Ashraf Abu Aisheh, i am working to
View Tutorial          By: Ashraf Abu Aisheh at 2008-11-09 14:56:39

2. I was trying to copy your coding and execute it, b
View Tutorial          By: Guest at 2012-01-02 04:08:21

3. an excellentttttttt siteee
View Tutorial          By: raza at 2011-04-02 10:39:46

4. Awesome article...
View Tutorial          By: Jiten TAluja at 2010-06-03 06:33:10

5. can you send me comm.jar required for this project
View Tutorial          By: gayatri at 2013-03-19 09:53:35

6. i9s this such a hard ?

my head was

View Tutorial          By: shadow_5566 at 2009-05-14 01:32:01

7. Thank you, that was short and enough :)
View Tutorial          By: Bilal korir at 2014-05-20 21:37:12

8. Sir , I am doing BCA . I want to know more about j
View Tutorial          By: sikandar at 2011-05-22 03:09:40

9. Thanks a ton!!! It was really very useful :)
View Tutorial          By: Ankit at 2015-05-11 12:30:41

10. can for statement be used in a switch statement fo
View Tutorial          By: Osei Quadwo at 2014-10-08 20:12:17