473,378 Members | 1,495 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

plz correct this program

A#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<ctype.h>A
#include<graphics.h>
#include<process.h>
fstream dat,dat1;
float gsal,pf;
char flname[]={"dsb"};
class emptax
{
public:
char
no[10],fname[20],lname[20],desig[20],bg[5],em[80],lnam[30],rnam[25],cnam[30],snam[30];
long int ph,pin,emp;
float
bsal,da,hra,cca,msal,lo,sd,tit,ti,tr,tf,tp,pt,tpt, ttp,nt,ec,lic,nsc,pm,ot,not,others;
void get_nam();
void dsp_nam();
void tax_cal();
void fl_write();
void fl_read();
void fl_delete();
void fl_insert();

}obj,obj1;

void emptax::get_nam()
{ cout<<"\nEmployee Code:";cin>>emp;
cout<<"First name:"; gets(fname);
cout<<"Last name:"; gets(lname);
cout<<"Designation:"; gets(desig);
cout<<"House no.:"; cin>>no;
cout<<"Location:"; gets(lnam);
cout<<"Region:"; gets(rnam);
cout<<"City:"; gets(cnam);
cout<<"State:"; gets(snam);
cout<<"Pincode:"; cin>>pin;
cout<<"Phone (resi):"; cin>>ph;

cout<<"\t\t"<<"\n\nENTER YOUR MONTHLY SALARY DETAILS\n";
cout<<"Basic salary per month:"; cin>>bsal;
cout<<"Enter your CCA:"; cin>>cca;
cout<<"DA:"; cin>>da;
cout<<"Lone Installments:"; cin>>lo;
cout<<" HRA:"; cin>>hra;
// cout<<"CCA:"; cin>>cca;
cout<<"other income:"; cin>>others;
cout<<"\nLIC premium:"; cin>>lic;
cout<<"NSC premium:"; cin>>nsc;
// cout<<"Income tax paid till last month @:"; cin>>pt;
cout<<"\n\nDonation for social cause:\n";
cout<<"Donation for PM funds:"; cin>>pm;
cout<<"Doantion for other trusts:"; cin>>ot;
cout<<"Tution fees:"; cin>>tf;
}
void emptax::dsp_nam()
{
clrscr();
cout<<"******************************!PERSONAL
DETAILS!********************************";
cout<<"\nName:\t\t"<<fname<<" "<<lname<<endl;
cout<<"\nAddress:\t";
cout<<no<<" "<<lnam<<",\n\t\t"<<rnam<<",\n\t\t"<<cnam
<<",\n\t\t"<<snam<<"\n\t\t"<<pin<<"\nPhone(resi):\ t"<<ph;

cout<<"\n\n***********************$MONTHLY/YEARLY SALARY
DETAILS$**************************";
cout<<"\n"<<"\t\t\t\tMONTHLY\t\t\tYEARLY";
cout<<"\n\nBasic salaray:\t\t\t"<<bsal<<"\t\t"<<bsal*12;
cout<<"\nCity Compancatory Allowence:\t"<<cca<<"\t"<<cca*12;
cout<<"\nDearness Allowence:\t\t"<<da<<"\t\t"<<da*12;
cout<<"\nHouse Rent Allowence:\t\t"<<hra<<"\t\t"<<hra*12;
cout<<"\nProvidend Fund:\t\t\t"<<pf<<"\t\t"<<pf*12;
cout<<"\nLone Installments:\t\t"<<lo<<"\t\t"<<lo*12;
cout<<"\n$GROSS SALARY$:\t\t\t"<<msal<<"\t\t"<<msal*12;
getch();

cout<<"\n\n******************************!INCOME TAX
DETAILS!******************************";
cout<<"\nGross Salary:\t\t\t"<<msal*12;
cout<<"\nStandard Deduction:\t\t"<<sd;
cout<<"\nTaxable Income:\t\t\t"<<ti;
cout<<"\nTotal Tax Payable:\t\t"<<tit;
cout<<"\nNet Tax Rebte:\t\t\t"<<tr;
cout<<"\Education Cess:\t\t\t"<<ec;
// cout<<"\nTotal Tax Paid:\t\t\t"<<tpt;
cout<<"\nNet Tax Still To Be Paid:\t"<<nt;
}

void emptax::tax_cal()
{
da=(bsal*11)/100;
hra=(bsal*15)/100;

msal=bsal+da+hra+cca+others;
gsal=(msal*12);

pf=(((bsal+da)*12)/100);

sd=nsc+pf+lic+tf ;
not=(ot*50)/100;

/* if(gsal<150000 && sd>30000)
{
sd=30000;
}
else
if(gsal>150000 && gsal<300000 && sd>25000)
{
sd=25000;
}
else
if(gsal>300000 && gsal<500000 && sd>20000)
{
sd=20000;
}
else
if(gsal>500000)
{
sd=0;
}

*/
ti=(gsal-(sd+pm+not));
if(ti<100000)
{
tit=0;
}
else
if(ti>100001 && ti<150000)
{
tit=((ti-50000)*10)/100;
}
else
if(ti>150001 && ti<250000)
{
tit=(((ti-150000)*20)/100);
}
else
if(ti>250001)
{
tit=(((ti-250000)*30)/100);
}
tr=(lic+nsc+(pf*12));
if(tr>100000)
{
tr=100000;
}
else
{
tr=tr;
}

tp=tit-tr;
ec=(2*tp)/100;
ttp=tp+ec;
tpt=pt*11;
nt=ttp-tpt;
if(nt<0)
nt=0;
}

void emptax::fl_write()
{
char ch;
dat.open(flname,ios::binary|ios::app);
do
{
dat1.open(flname,ios::in|ios::binary);
clrscr();
cout<<"\n -/-/-/-/-/-/-/-/-/-/-/-/-/--- Employee's Information
---/-/-/-/-/-/-/-/-/-/-/";
obj1.get_nam();
do
{
if(dat1.fail())
{
break;
}
else
{
dat1.read((char*)&obj,sizeof(emptax));
if(!dat.eof())
{
if(emp==obj1.emp)
{
clrscr();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\t-----Sorry This Record Already
Exists(DUPLICATION NOT ALLOWED)------ ";
getch();
dat.close();
dat1.close();
return;
}
}
}
}while(!dat1.eof());
dat.write((char*)&obj1,sizeof(emptax));
clrscr();
cout<<"\n\n\n\n\n\n\n\n\t\t ----Do You Want To Add More----";
do
{
ch=tolower(getche());
}while(ch!='y' && ch!='n');
}while(ch=='y');
dat.close();
dat1.close();
}

void emptax::fl_read()
{
dat.open(flname,ios::binary|ios::in);
do
{
if(dat.fail())
{
clrscr();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t-----Sorry This File Contain No
Data------ ";
dat.close();
return;
}
else
{
dat.read((char*)&obj,sizeof(emptax));
if(!dat.eof())
{
obj.tax_cal();
obj.dsp_nam();
}
getch();
}
}while(!dat.eof());
cout<<"\n\t\t--------END OF THE DATABASE-----";
getch();
dat.close();
}

void emptax::fl_insert()
{
dat.open(flname,ios::binary|ios::in);
dat1.open("temp.dat",ios::out|ios::binary);
clrscr();
cout<<"\n Enter The Record To Be Inserted ::";
obj1.get_nam();
obj1.tax_cal();
do
{
if(dat.fail())
{
clrscr();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t-----Sorry This File Contain No
Data------ ";
dat.close();
dat1.close();
getch();
return;
}
else
{
dat.read((char*)&obj,sizeof(emptax));
if(emp==obj1.emp)
{ clrscr();
cout<<"\n\n\n\n\n\n\n\n\n\t\t-----This Record Already
Exists-------";
cout<<"\n\n\n\n\t\t-----Unsuccessfull Record Insertion------";
dat1.close();
dat.close();
getch();
return;
}
if(emp obj1.emp)
{
break;
}
if(!dat.eof())
{
dat1.write((char*)&obj,sizeof(emptax));
}
}
}while(!dat.eof());
dat1.write((char*)&obj1,sizeof(emptax));
do
{
if(dat.fail())
{
cout<<" ";
}
else
{
if(!dat.eof())
{
dat1.write((char*)&obj,sizeof(emptax));
}
dat.read((char*)&obj,sizeof(emptax));
}
}while(!dat.eof());
dat.close();
dat1.close();
if((remove(flname)==0)&&(rename("temp.dat",flname) ==0))
{ clrscr();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t--------Record Inserted
Successfully-------";
getch();
}
}

void emptax::fl_delete()
{
int empn;
dat.open(flname,ios::binary|ios::in);
dat1.open("temp.dat",ios::out|ios::binary);
cout<<"\n Enter The Employee Code No.::";
cin>>empn;
clrscr();
do
{
if(dat.fail())
{ cout<<"Unable To Open";
dat.close();
dat1.close();
return;
}
else
{ dat.read((char*)&obj,sizeof(emptax));
if(emp==empn)
{
break;
}
if(!dat.eof())
{
dat1.write((char*)&obj,sizeof(emptax));
}
}
}while(!dat.eof());
if(emp!=empn)
{ clrscr();
cout<<"\n\n\n\n\n\n\n\n\n\n\t\t ------THIS RECORD DOESN'T
EXISTS-----";
getche();
dat.close();
dat1.close();
return;
}
do
{
if(dat.fail())
{ cout<<"----Error Occurred Trminating Function-----";
getch();
dat.close();
dat1.close();
return;
}
else
{ dat.read((char*)&obj,sizeof(emptax));
if(!dat.eof())
{
dat1.write((char*)&obj,sizeof(emptax));
}
}
}while(!dat.eof());
dat.close();
dat1.close();
if((remove(flname)==0)&&(rename("temp.dat",flname) ==0))
{
clrscr();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t--------Record Deleted
Successfully-------";getch();
}
}

void main()
{
textcolor(1);
textbackground(6);
char ch;
do
{
clrscr();
cout<<"Enter ur choice as mentioned";
cout<<"\n Enter Records"
<<"\n View Records"
<<"\n Insert Records"
<<"\n Delete Records"
<<"\n Quit Records\n";
cin>>ch;
switch(ch)
{
case 'e':obj.fl_write();
break;
case 'v':obj.fl_read();
break;
case 'i':obj.fl_insert();
break;
case 'd':obj.fl_delete();
break;
case 'x':exit(0);
break;
default:cout<<"!Wrong choice!";
break;
}
clrscr();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t -----Do You Want To Continue----";
do
{ ch=tolower(getche());
}while(ch!='y' && ch!='n');
}while(ch=='y');
clrscr();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t--------T H A N K Y O U -------";
getch();
}

Aug 13 '06 #1
0 1711

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Al Repasky | last post by:
The program I have written with VB/NET 2003 has a Myapp.exe.config file that I did not know I would be creating. My program using an Access db and can not find the DB file after building the...
1
by: Richard Golebiowski | last post by:
I have been trying to figure this out for quite some time and cannot find any examples in VB.Net or in VB that work correctly. I am working on an application where I want the user to be able to...
14
by: john.burton.email | last post by:
I've done some extensive searching and can't seem to find an answer to this - Is it correct to using "using" with templates, for example: using std::vector; Or do I need to specify the type...
12
by: kim | last post by:
The c program is an example and should be correct. I tried to compile the c file with MS studio 6.0. But failed with the several err and warning messages. Does anyone know how to make it work?...
3
by: ranjeet.gupta | last post by:
Dear All, I have a querry regarding the .dll and .lib, what I understood I am pendowing , well suppose Imake a program in which I have a function named MyFunction(); int main () {
4
by: alisbub | last post by:
1. Write an interactive program that asks the user to input the length and width of a rectangular lawn. The dimensions should be in yards. Your program should compute the area of the lawn in square...
5
by: mohammaditraders | last post by:
Question # 1 Write a program which consists of a class named Student, the class should consists of three data members Name, Ob_marks, Total_marks and two member functions...
4
by: banansol | last post by:
I read the thread Floating point rounding error and I saw Richard Heathfield's description with several lines like: 0.1 = 1/2 = 0.5 - too large 0.01 = 1/4 = 0.25 - too large 0.001 = 1/8 = 0.125...
6
by: jt | last post by:
#include <stdio.h> void f(); int main() { long int i; i=20; f(); i = 10; printf ("\n%d\n",i);
3
by: raghulvarma | last post by:
I did a small sample with three tier architecture and i need to know whether the flow of the program is correct or not.The pgm works fine. Inside web.config <configuration> <appSettings> ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.