cbse computer science project

Embed Size (px)

Citation preview

  • 8/13/2019 cbse computer science project

    1/19

    TELEPHONE DIRECTORY

    PROJECT BY:

    PRAVEEN P.

    CLASS: XII

  • 8/13/2019 cbse computer science project

    2/19

    ACKNOWLEDGEMENT

    I take this opportunity to express my profound sense of gratitude andrespect to all those who helped me throughout this venture.

    I owe my regard to Mrs. Sri Vidhya Mouli, Principal of TVScademy , for her cooperation and valua!le support and for givingme the opportunity to undertake this pro"ect work and providing thenecessary infrastructure.

    I would like to express my heartfelt thanks to my revered teacher andguide Mrs. #ithya marnaath for her valua!le guidance,encouragement and support throughout my studentship under her atthe institute. This pro"ect is her visuali$ation and owes a lot of itsfunctionality to her.

    %ast !ut not the least& I owe my overwhelming gratitude to my familyand friends who gave me constant support and motivation tocontinue with this 'ndeavour.

  • 8/13/2019 cbse computer science project

    3/19

    CONTENTS:

    System description at a glance

    Pro!lem (escription

    o )e*uirement nalysis

    o +ardware and Software re*uirements

    System specification

    o System (esign

    o (ata (esign

    o rchitectural (esign

    o (ata (ictionary

    ile (esign Structures

    Procedure-unction (escription

    Program Source ode

  • 8/13/2019 cbse computer science project

    4/19

    System Desc!"t!#$ %t % G&%$ce

    TELEPHONE DIRECTORYis a listing of telephone su!scri!ers in a geographical area

    or su!scri!ers to services provided !y the organi$ation that pu!lishes the directory. Its

    purpose is to allow the telephone num!er of a su!scri!er identified !y name.

    My aim is to develop a computer program to ensurethat theentries in the telephone

    directory is kept track and data is easy to access.

    iles/

    There is a file for recording the details such as name and phone num!er of all the customers.

    I$"'ts %e:

    To add new records to the data!ase

    To delete a record 0uthorised cess1

    To modify the details of an individual record 0uthorised cess1

    O't"'ts %e:

    To show the phone num!er for a re*uested name

    To show the name for a re*uested phone num!er

    To list the names and phone num!er of all the entry

  • 8/13/2019 cbse computer science project

    5/19

    P#(&em Desc!"t!#$

    Re)'!eme$t A$%&ys!s:

    2e have studied the existing system in detail. The finding of our study yields various pieces of

    information which are descri!ed in the following manner. or keeping track of the phonenum!ers, we enter the following details/

    #ame

    Phone num!er

    REQUIRED OUTPUT OF THE SYSTEM:

    The computeri$ed system generates the following reports as/

    To show the entered details of a name

    To show the phone num!er of the re*uested person

    To list all the entries

    To show the details of all the entries after the re*uired modifications are made.

    HARDWARE AND SOFTWARE REQUIREMENTS:

    ssuming that a general system offers entry of a!out 3444s in num!er, the volume of the

    information to !e handled is a!out thousands of characters. ll this suggests that the choice of

    a computer 567 or e*uivalent to a!out 894 M: +ard (isk and a!out 6 to 37 ;: )M. The

    availa!ility of sophisticated programming tool is imperative. Thus,

  • 8/13/2019 cbse computer science project

    6/19

    System s"ec!*!c%t!#$s

    System +es!,$-te /e$e& #* system e$,!$ee!$,

    The importance of software design can !e stated with a single word *uality. (esign is the place

    where *uality is fostered in software development. (esign provides us with representations ofsoftware that can !e accessed for *uality. System design serves as the foundation for all

    software engineering and maintenance steps that follow. (esign sits at the technical kernel of

    the software engineering process and is applied regardless of the development paradigm that

    is used. =nce software re*uirements have !een analy$ed and specified, the software design is

    first of the three, technical activities > design, code and test that are re*uired to program the

    software. The flow of information during this technical phase of the software engineering

    process is illustrated in the given figure/

  • 8/13/2019 cbse computer science project

    7/19

    D%t% Des!,$

    (ata design is the first of the three design activities that are conducted during system

    development. The impact of data structure on program structure and procedural complexity

    leads data design to have a profound influence on systems *uality.

    ll the data o!"ects re*uired !y this system are listed !elow/

    1. Td.txt

    #ame of entry>maximum of 84 characters

    Phone num!er

    Tempt.txt

    Stores temporary values of name and phone num!er

    The a!ove data can !e designed in the form of a relational data!ase with course name as the

    key field.

  • 8/13/2019 cbse computer science project

    8/19

    Ac!tect'%& Des!,$

    System Des!,$ D!%,%m

    Insert entries

    Modify

    (elete

    (isplay

    Search

    name

    using

    Phone

    Search

    Phone

    num!er

    using name

    uthenticated

    ccess

  • 8/13/2019 cbse computer science project

    9/19

    DATASTR0CT0RES

    FILE DESIGN STRUCTURES

    I%'/ ?td.txt?

    N%me Wee 0se+ Desc!"t!#$

    #ame

    Phone

    num!er

    lass @Ph!ook?lso stored in file @td.txt?

    har 84 characters

    8 characters

    pn To get phone num!er that needs to !esearched for the name

    har >84characters

    n To get name that needs to !e

    searched for the phone num!er

    To get name that needs to !e

    modified

    To get name that needs to !edeleted

    har>84 character

    passTo contain the password Int

    inpass To get the password from the user Int

    N%me Wee 0se+ Desc!"t!#$Phone num!er ile>To specify the phone

    num!er of the individual entryhar>84characters

    #ame ile>to specify the name of theentry

    har>84 characters

  • 8/13/2019 cbse computer science project

    10/19

    PROCED0RE120NCTION DESCRIPTION

    Cla e!t"#: mem$e" %&!'t()!

    N%me Ret'$ +%t%ty"e

    P'"#se Desc!"t!#$

    getdata01 Void function to get datafrom user

    ccepts values from user 0#ame and phonenum!er1

    putdata01 Void function to show dataon screen

    (isplays the details 0no input re*uired1

    modify01 Void function to get newdata from user

    sks whether the old details are re*uiredand needs input of the new details of the

    modified entry detailsgetname01 char function to return type

    of entryAs nameccessor function to return the name ofentry

    N)!*mem$e" %&!'t()!:)&t(de 'la de%(!(t()!

    N%me Ret'$ +%t% ty"e P'"#sewriteBentry01 void function to write record in !inary file

    displayall01 void function to all display phonenum!er given !y user

    search!yBpho01 void function to search name !y givenphone num!er

    search!yBname01 void function to search phone num!er!y given name

    delete01 void function to delete a record

    update01 void function to update a given record !ygetting the customer name

  • 8/13/2019 cbse computer science project

    11/19

    SO0RCE CODE:

    CincludeDiostream.hE

    CincludeDfstream.hECincludeDconio.hE

    CincludeDstdio.hE

    CincludeDstring.hE

    class ph!ook

    F

    pu!lic/

    char nameG84H,phnoG84H&

    void getdata01

    F

    coutDD'nter #ame/ DDJn&

    cinEEname&

    coutDD'nter Phone #o/ DDJn&

    cinEEphno&

    K

    void putdata01

    F

    coutDD#ame/ DDnameDDJn&

    coutDDPhone #o/ DDphnoDDJn&

    K

    charL getname01

    F

    return name&

    K

    void modify01

    F

    char nmG84H,phG84H&

    coutDD#ame/ /DDname&

  • 8/13/2019 cbse computer science project

    12/19

    coutDDJnPhone no/ DDphno&

    coutDDJn'nter new detailsJn&

    coutDD#ew #ame/ 0'nter . to retain old values1&

    cinEEnm&

    coutDD#ew Phone no/ 0'nter . to retain old values1&

    cinEEph&

    if0strcmp0nm,.1NO41

    strcpy0name,nm1&

    if0strcmp0ph,.1NO41

    strcpy0phno,ph1&

    K

    Ka,!&

    void insert01

    F

    fstream f&

    f.open0td.txt,ios//inios//outios//ateios//!inary1&

    a.getdata01&

    f.write00char L1 Qa,si$eof0a11&

    f.clear01&

    f.flush01&

    K

    void displayall01

    F

    fstream f&

    f.open0td.txt,ios//inios//outios//ateios//!inary1&

    f.seekg041&

    while0f1

    F

    f.read00char L1 Qa,si$eof0a11&

    if0Nf.eof011

  • 8/13/2019 cbse computer science project

    13/19

    a.putdata01&

    K

    f.clear01&

    f.flush01&

    getch01&

    K

    void search!yBpho01

    F

    int pnoO4&

    char pnG84H&

    fstream f&

    f.open0td.txt,ios//inios//outios//ateios//!inary1&

    coutDD'nter Phone num!er/&

    cinEEpn&

    f.seekg041&

    while0f.read00char L1 Qa,si$eof0a111

    F

    if0Nstrcmp0a.phno,pn11

    F

    a.putdata01&

    pnoO3&

    K

    K

    if0pnoOO41

    coutDD#o Such )ecord 'xistsNNNN&

    f.close01&

    getch01&

    K

    void search!yBname01

  • 8/13/2019 cbse computer science project

    14/19

    F

    int naO4&

    char nG84H&

    fstream f&

    f.open0td.txt,ios//inios//outios//ateios//!inary1&

    coutDDJn'nter #ame/&

    cinEEn&

    f.seekg041&

    while0f1

    F

    f.read00char L1 Qa,si$eof0a11&

    if0strcmp0a.name,n1OO41

    a.putdata01&

    naO3&

    K

    f.clear01&

    if0naOO41

    coutDD)ecord #ot ound&

    getch01&

    K

    void deleteentry01

    F

    fstream f&

    f.open0td.txt,ios//inios//!inary1&

    fstream f3&

    f3.open0temp.txt,ios//out1&

    char foundOf,nG84H&

    coutDD'nter name whose record is to !e deletedJn&

    cinEEn&

    f.seekg041&

  • 8/13/2019 cbse computer science project

    15/19

    while0f1

    F

    f.read00char L1 Qa,si$eof0a11&

    if0strcmp0a.getname01,n1OO41

    foundOt&

    else

    f3.write00char L1 Qa,si$eof0a11&

    K

    if0foundOOf1

    coutDD)ecord not foundNNNJn&

    f.close01&

    f3.close01&

    remove0td.txt1&

    rename0temp.txt,td.txt1&

    coutDD#ow the file contains/&

    displayall01&

    K

    void update01

    F

    fstream f&

    f.open0td.txt,ios//inios//outios//ateios//!inary1&

    int pos&

    char foundOf,nG84H&

    coutDD'nter name whose record is to !e modifiedJn&

    cinEEn&

    f.seekg041&

    while0f1

    F

    posOf.tellg01&

    f.read00char L1 Qa,si$eof0a11&

  • 8/13/2019 cbse computer science project

    16/19

    if0strcmp0a.getname01,n1OO41

    F

    a.modify01&

    f.seekg0pos1&

    f.write00char L1 Qa,si$eof0a11&

    foundOt&

    !reak&

    K

    K

    if0foundOOf1

    coutDD)ecord not foundNNNJn&

    coutDDJn#ow the file containsJn&

    f.clear01&

    displayall01&

    K

    void main01

    F

    char pnG84H,nG84H&

    int c,pnoO4,naO4,passO38R59,inpass&

    fstream f&

    f.open0td.txt,ios//inios//outios//ateios//!inary1&

    char chOy&

    coutDDJnJnJnJnJnJnJnJnJtJt2'%=M' T= T'%'P+=#' (I)'T=) S')VI'SJnJnJn&

    coutDDJtJtPress 'nter to ontinue...&

    getch01&

    while0chOOy1

    F

    clrscr01&

  • 8/13/2019 cbse computer science project

    17/19

    coutDDJnJnJtJt2'%=M' T= T'%'P+=#' (I)'T=) S')VI'SJnJnJn&

    coutDDJtJt3. 'nter recordJn&

    coutDDJtJt8. (isplay all recordsJn&

    coutDDJtJtR. Search Ph noJn&

    coutDDJtJt5. Search #ameJn&

    coutDDJtJt9. pdate recordJn&

    coutDDJtJt7. (elete recordJn&

    coutDDJtJtU. 'xitJnJnJn&

    coutDDJtJt'nter your choiceJn&

    cinEEc&

    switch 0c1

    F

    case 3/

    F

    insert01&

    !reak&

    K

    case 8/

    F

    displayall01&

    !reak&

    K

    case R/

    F

    search!yBpho01&

    !reak&

    K

    case 5/

    F

    search!yBname01&

  • 8/13/2019 cbse computer science project

    18/19

    !reak&

    K

    case 9/

    F

    coutDDJtJt PasswordJnJtJt&

    cinEEinpass&

    if0passOOinpass1

    update01&

    else

    F

    coutDDJtJt2rong Password&

    !reak&

    K

    K

    case 7/

    F

    coutDDJtJt'nter PasswordJnJtJt&

    cinEEinpass&

    if0passOOinpass1

    deleteentry01&

    else

    F

    coutDDJtJt2rong Password&

    !reak&

    K

    K

    case U/

    chOn&

    f.clear01&

    f.flush01&

  • 8/13/2019 cbse computer science project

    19/19

    !reak&

    K

    K

    K