Computer Project- NIRMAL VIDALAYA

download Computer Project- NIRMAL VIDALAYA

of 38

Transcript of Computer Project- NIRMAL VIDALAYA

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    1/38

    CERTIFICATE

    Certified to be bonafide work

    done by

    Master MIHIR KUMAR PRADHAN of

    class 12th

    B

    In the Computer lab during the

    year 2012-13

    Date P.G.T Computer

    Submitted for

    Examination held in Computer LAB at

    Nirmal Vidyalay

    Date: Nirmal Vidyalay

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    2/38

    ACKNOWLEDGEMENT

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    3/38

    Contents

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    4/38

    AIM OF PROJECT

    To develop software for to generate salary statement

    according to the employeesbasic salary by providing following

    allowances:-

    1) Provide 70% DA (Dearness Allowance).

    2) Provide 30% HRA (House Rent Allowance)

    3) Provide 15% TA (Travelling Allowance)

    :-

    1) Provide 65% DA (Dearness Allowance).2) Provide 25% HRA (House Rent Allowance)

    3) Provide 10% TA (Travelling Allowance)

    Deduct PF from Net salary,

    If Net salary >=7,000 then 5% PF of Net salary

    If Net salary

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    5/38

    Generate a record for at least 10 employees and store all the data in

    file.

    PROGRAM LISTING:-

    #include

    #include //for gets()

    #include //for delay()

    #include //for exit()

    #include //for file handling

    operations

    class Graphics

    {

    public:

    void frame1(); /*

    void frame2(); Prototypevoid frame3(); declared

    void progress(); */

    };

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    6/38

    void Graphics::frame1() //Member function definedoutside //class

    {

    for(int x=10; x

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    7/38

    gotoxy(22,2);

    cout

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    8/38

    cout

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    9/38

    gotoxy(x,25);

    cout

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    10/38

    cout

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    11/38

    cout

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    12/38

    public:

    void getPersonal();

    void printPer();};

    void Personal::getPersonal()

    {

    clrscr();

    Graphics g; //Object of Graphics classg created

    g.frame1();

    gotoxy(22,4);

    cout

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    13/38

    gotoxy(32,12);

    gets(address);

    }void Personal::printPer()

    {

    clrscr();

    Graphics g;

    g.frame1();

    gotoxy(22,4);

    cout

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    14/38

    public:

    long idno;

    float bs, ns, gs;float ta, da, hra;

    float pf;

    public:

    void getEmp();

    void printEmp();

    void listEmp(int);

    };

    void Employee::getEmp()

    {

    getPersonal();

    clrscr();

    Graphics g;

    g.frame1();

    gotoxy(22,4);

    cout

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    15/38

    gotoxy(13,8);

    cout

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    16/38

    {

    da=bs*65/100;

    ta=bs*10/100;hra=bs*25/100;

    gotoxy(13,10);

    cout

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    17/38

    cout

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    18/38

    cout

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    19/38

    gotoxy(13,10);

    cout

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    20/38

    cout

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    21/38

    clrscr();

    while(1)

    {clrscr();

    G.frame2();

    gotoxy(37,19);

    cin>>op;

    switch(op)

    {

    case 1:

    E.getEmp();

    file.open("employee.txt",ios::app); //employee linked

    //with file in I/Omode

    file.seekp(0,ios::end); //go toend of file

    file.write((char*)&E, sizeof(E)); // write toemployee

    file.close(); //de-link employee from file(stream object)

    break;

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    22/38

    case 2:

    clrscr();

    G.frame1();gotoxy(23,11);

    coutid;

    file.open("employee.txt",ios::in);

    file.seekg(0,ios::beg); // movesget_pointer to beginning

    // of file

    int c=0;

    while(file.read((char*)&E, sizeof(E)))

    {

    if(id==E.idno)

    {

    E.printPer();

    c++;

    }

    }

    if(c==0)

    {

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    23/38

    clrscr();

    G.frame1();

    gotoxy(20,11);cout

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    24/38

    {

    E.printEmp();

    c++;}

    }

    if(c==0)

    {

    clrscr();

    G.frame1();

    gotoxy(20,11);

    cout

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    25/38

    while(file.read((char*)&E, sizeof(E)))

    {

    E.listEmp(y);y++;

    }

    file.close();

    break;

    case 5:

    clrscr();

    G.frame1();

    file.open("employee.txt",ios::out);

    file.close();

    gotoxy(23,11);

    cout

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    26/38

    getch();

    }

    getch();}

    INPUT LISTING:-

    PERSONAL DETAILS:-

    Employees Name : SSuummiittSSaahhuu

    FF//HHNNaammee :: SSuurreesshh SSaahhuu

    AAddddrreessss :: DDhhaarraammppuurraa

    IIDD NNoo.. :: 11

    BBaassiiccSSaallaarryy :: 1155000000

    Employees Name : MMaanniisshh SSaahhuu

    FF//HHNNaammee :: JJaaggddiisshh SSaahhuu

    AAddddrreessss :: PPHHEE--HH--1144

    IIDD NNoo.. :: 22

    BBaassiiccSSaallaarryy :: 1166000000

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    27/38

    Employees Name : BBhhuuppeennddrraa PPaarrggaanniihhaa

    FF//HHNNaammee :: RRaajjeennddrraa PPaarrggaanniihhaa

    AA

    dd

    dd

    rree

    ssss

    ::

    AA

    vv

    aa

    nn

    ttiikk

    aa

    CC

    oo

    lloo

    nn

    yy,,

    GG

    --77

    IIDD NNoo.. :: 33

    BBaassiiccSSaallaarryy :: 1144000000

    Employees Name : MMiihhiirrPPrraaddhhaann

    FF//HHNNaammee :: AAbbhhiimmaannyyuu PPrraaddhhaann

    AAddddrreessss :: BB..RR CCoollddSSttoorraaggee ((PP)) LLTTDD

    IIDD NNoo.. :: 44

    BBaassiiccSSaallaarryy :: 1177000000

    Employees Name : GGaauurraavvAArroorraa

    FF//HHNNaammee :: VViippiinn AArroorraa

    AAddddrreessss :: PPrraattaappggaannjj

    IIDD NNoo.. :: 55

    BBaassiiccSSaallaarryy :: 1133000000

    Employees Name : SShhuubbhhaamm BBaassrraannii

    FF//HHNNaammee :: AAddiittyyaa BBaassrraannii

    AAddddrreessss :: KKuummhhaarrppaarraa

    IIDD NNoo.. :: 66

    BBaassiiccSSaallaarryy :: 2200000000

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    28/38

    Employees Name : SShhuubbhhaamm SShhuukkllaa

    FF//

    HH

    NN

    aa

    mm

    ee

    ::

    PP

    uu

    rrsshh

    oo

    ttttaa

    mm

    SS

    hh

    uu

    kk

    llaa

    AAddddrreessss :: NNaayyaappaarraa

    IIDD NNoo.. :: 77

    BBaassiiccSSaallaarryy :: 2211000000

    Employees Name : AAkkaasshh KKhhaammbbaarrii

    FF//HHNNaammee :: IIsshhwwaarrnnaatthh KKhhaammbbaarrii

    AAddddrreessss :: AAaassnnaa

    IIDD NNoo.. :: 88

    BBaassiiccSSaallaarryy :: 1199000000

    Employees Name : TToobbiiaa JJoohhnn

    FF//HHNNaammee :: MMaatttthheewwJJoohhnn

    AAddddrreessss :: AAvvaannttiikkaa CCoolloonnyy

    IIDD NNoo.. :: 99

    BBaassiiccSSaallaarryy :: 1188000000

    Employees Name : MMaannoojjTTiiwwaarrii

    FF//HHNNaammee :: MMuukkeesshh TTiiwwaarrii

    AAddddrreessss :: PPaattppaarrggaannjj

    IIDD NNoo.. :: 1100

    BBaassiiccSSaallaarryy :: 1177000000

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    29/38

    OUTPUT LISTING:-

    NNaammee BBaassiicc DDAA TTAA HHRRAA NNeett PPFF GGrroossss

    SSuummiittSSaahhuu 1155000000 1100550000 22225500 44550000 3322225500 11661122..55 3300663377..55

    MMaanniisshh

    SSaahhuu

    1166000000 1111220000 22440000 44880000 3344440000 1177220011 3322668800

    BBhhuuppeennddrraa

    PPaarrggaanniihhaa

    1144000000 99880000 22110000 44220000 3300110000 11550055 2288559955

    MMiihhiirr

    PPrraaddhhaann

    1177000000 1111990000 22555500 55110000 3366555500 11882277..55 3344772222..55

    GGaauurraavv

    AArroorraa

    1133000000 99110000 11995500 33990000 2277995500 11339977..55 2266555522..55

    SShhuubbhhaamm

    BBaassrraannii

    2200000000 1144000000 33000000 66000000 4433000000 22115500 4400885500

    SShhuubbhhaamm

    SShhuukkllaa

    2211000000 1144770000 33115500 66330000 4455115500 22225577..55 4422889922..55

    AAkkaasshh

    KKhhaammbbaarrii

    1199000000 1133330000 22885500 55770000 4400885500 22004422..55 3388880077..55

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    30/38

    TToobbiiaa JJoohhnn 1188000000 1122660000 22770000 55440000 3388770000 11993355 3366776655

    MMaannoojj

    TTiiwwaarrii

    1177000000 1111990000 22555500 55110000 3366555500 11882277..55 3344772222..55

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    31/38

    Salient Features:-

    ii)) IInnoouurrpprrooggrraammwweeccaannaallssoo sseeaarrcchhffoorraannEEmmppllooyyeeeessppeerrssoonnaallddeettaaiillsstthhrroouugghhhhiissIIDDNNoo..

    SSaammpplleerruunnffoorraanneemmppllooyyeeeeiissggiivveennbbeellooww::

    If the entered ID No. does not exist, error message is

    printed as described below :

    IInnppuuttIIDDNNoo.. ::44

    PERSONAL DETAILS

    Employees Name :MMiihhiirrPPrraaddhhaann

    FF//HHNNaammee :: AAbbhhiimmaannyyuu PPrraaddhhaann

    AAddddrreessss :: BB..RR CCoollddSSttoorraaggee ((PP)) LLTTDD

    IInnppuuttIIDDNNoo.. ::1111

    IIDDNNoo.. ddooeessnnootteexxiisstt!!!!!!

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    32/38

    ii) In this program we can also search the Salary

    Details of an employee through his ID No.

    Sample run for an employee is given below:

    If the entered ID No. does not exist, error message is

    printed as described below:

    IInnppuuttIIDDNNoo.. ::99

    SALARYDETAILS

    ID No. :9

    Basic Salary : 18000

    D.A. : 12000

    T.A. : 2700

    H.R.A. : 5400

    Net Salary : 38700

    P.F. : 1935

    Gross Salary : 36765

    IInnppuuttIIDDNNoo.. ::2211

    IIDDNNoo.. ddooeessnnootteexxiisstt!!!!!!

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    33/38

    COMMANDSUSED:-

    S

    No.Command Syntax Description

    1 #include -

    It is an

    input-

    output file

    stream

    class. It

    provides

    support for

    simultaneo

    us input

    and output

    operations.

    2#include

    -

    It contains

    definition

    of

    functions

    like clrscr().

    3 #include -

    It is a

    header file

    included to

    use delay().

    4 #include -

    It is a

    header file

    included to

    use input-

    output

    manipulato

    rs

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    34/38

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    35/38

    9 Graphics g;Class_name

    Object_name;

    This

    command

    creates an

    object of

    the Class-name.

    10

    void

    Employee::listEmp(int)

    ;

    void

    Graphics::frame1();

    void

    Graphics::progress();

    Return_type

    Class_Name::Function_

    Name();

    This

    command

    is used to

    define a

    function

    outside the

    class

    definition.

    11 g.frame1();Object_Name.Function_

    Name();

    This

    command

    calls the

    public

    member

    function of

    the Class.

    12class Employee:public

    Personal

    class

    Derived_Class:public

    Base_Class

    To inherit a

    class(Base

    Class)

    publicly

    into

    another

    class(Derived Class).

    13 fstream file(); -

    Creates an

    input-

    output

    stream.

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    36/38

    14

    file.open("employee.tx

    t", ios::out);

    stream_object.open(fil

    e-name,file-

    mode_1|file-mode_2);

    This

    command

    opens

    employee.

    txt file inoutput

    mode.

    15 file.seekp(0,ios::end);Stream_Object.seekp(0,

    ios ::{beg,cur,end});

    Command

    to move

    put_pointer

    to desired

    location in

    file.

    16file.write((char*)&E,

    sizeof(E));

    Stream_Object.write((ch

    ar*)&buf,sizeof(buf));

    Command

    to write a

    class to a

    file.

    17 file.seekg(0,ios::beg);

    Stream_Object.seekg(0,ios::{beg,cur,end});

    Command

    to move

    get_pointerto desired

    location in

    file.

    18file.read((char*)&E,

    sizeof(E));

    Stream_Object.read((ch

    ar*)&buf,sizeof(buf));

    Command

    to read a

    class from

    a file.

    19 file.close(); stream_object.close();

    Terminate

    association

    with file.

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    37/38

    IMPLEMENTATION:-

  • 7/29/2019 Computer Project- NIRMAL VIDALAYA

    38/38