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. why are we using it ch = str.charAt(i);
View Tutorial          By: Rumman at 2014-10-10 19:42:42

2. Hello,
this is good example, but that is on

View Tutorial          By: Zubair at 2011-11-10 20:46:39

3. Thank you. It is very good.
View Tutorial          By: tapes pra at 2011-12-08 09:23:31

4. The code is working for me as i have included &quo
View Tutorial          By: MOHAN at 2011-06-29 04:08:04

5. it is very good website for IT students
View Tutorial          By: jeecee at 2013-03-21 12:23:46

6. This is really helpful, i'm planning to also add a
View Tutorial          By: JhunZhen at 2011-07-09 21:42:32

7. Hi,

I have tried with your script a

View Tutorial          By: Ivan at 2011-09-08 21:17:36

8. great work..keep it up.
View Tutorial          By: faizaan at 2011-04-29 12:23:39

9. good
View Tutorial          By: gummalla subbarao at 2011-03-09 01:24:58

10. Don't forget the native type char, which is a 16 b
View Tutorial          By: Ron Stern at 2011-09-18 17:24:12