• Join over 1.2 million students every month
  • Accelerate your learning by 29%
  • Unlimited access from just £6.99 per month
Page
  1. 1
    1
  2. 2
    2
  3. 3
    3
  4. 4
    4
  5. 5
    5
  6. 6
    6
  7. 7
    7
  8. 8
    8
  9. 9
    9
  10. 10
    10
  11. 11
    11
  12. 12
    12
  13. 13
    13
  14. 14
    14
  15. 15
    15
  16. 16
    16
  17. 17
    17
  18. 18
    18
  19. 19
    19
  20. 20
    20
  21. 21
    21
  22. 22
    22
  23. 23
    23
  24. 24
    24
  25. 25
    25
  26. 26
    26
  27. 27
    27
  28. 28
    28
  29. 29
    29
  30. 30
    30
  31. 31
    31
  32. 32
    32
  33. 33
    33
  34. 34
    34
  35. 35
    35
  36. 36
    36
  37. 37
    37
  38. 38
    38
  39. 39
    39
  40. 40
    40
  41. 41
    41
  42. 42
    42
  43. 43
    43
  44. 44
    44
  45. 45
    45
  46. 46
    46
  47. 47
    47
  48. 48
    48
  49. 49
    49
  50. 50
    50
  51. 51
    51
  52. 52
    52
  53. 53
    53
  54. 54
    54
  55. 55
    55
  56. 56
    56
  57. 57
    57
  58. 58
    58
  59. 59
    59
  60. 60
    60

3SFE504 - Object Oriented Programming - Linear and Independent Hash Table code

Extracts from this document...

Introduction

image11.png

School of Informatics

DEPARTMENT OF INFORMATION SYSTEMS AND COMPUTING

3SFE504: Object oriented programming

COURSEWORK

Student Id

Student First Name

Student Surname

2007053

Kavindya

Isuru

2007020

Malshani

Nanayakkara

image00.png

CONTENTS

                                                                                                 Page

Introduction        3

Implementation

        Group Work        5

        Student A

                Implementation        10

                Assumption        24

        Student B                

                Implementation        25

Testing

        Student A:

                 Test Plan        44

                ScreenShots        45

        Student B:        

                Test Plan        50

                ScreenShots        51

Self-Evaluation

        Individual Reports        59

INTRODUCTION

This coursework was done in teams’ of two group members.  

Group V was made of up of:

        N.T. I Kavindya         and         Malshani Nanayakkara

        In this project, we were asked to create a dictionary object, which was capable of storing words and its definitions. Each word could contain more than one definition. The dictionary object we created should contain the facilities of viewing the words in the dictionary, adding new words, searching new words and printing it to a file.

        The words and their definitions would be stored in an external file called ‘defs.dat’. So every time, our application is run, the words and their definitions should be read in. We each created a hash table to accommodate these. Student A’s part, done by Kavindya, reads in the word and stores them using the linear rehashing technique. Student B’s part, done by Malshani, stores the words in the hash table using the independent rehashing technique.

IMPLEMENTATION

GROUP WORK

                                Definition and List Class files

Definition.h

//Definition.h

#ifndef Definition_h

#define Definition_h

#include <string>

#include <cstdlib>

using namespace std;

class Definition

{

        public:

                Definition();                //constructor (initialisation)

                ~Definition();

                //setter methods

                void setDefinition(string def);

                void setNext(Definition*);

                //getter methods

                string getDefinition();

                Definition* getNext();

        private:

                string definition;

                Definition* next;

};

#endif

Definition.cc

#include "Definition.h"

#include <string>

#include <cstdlib>

#include <iostream>

using namespace std;

Definition::Definition()

{

        definition = "NULL";

        next = NULL;

}

Definition::~Definition()

{

}

void Definition::setDefinition(string def)

{

        definition=def;

}

void Definition::setNext(Definition* n)

{

        next=n;

}

...read more.

Middle

{

        if(w1==w2)

        {

                return false; // if word to word equal then return false

        }

        else // if not return true

                return true;

}

//sorting the dictionary

void sortString(LinHTable& Ss)

{

        bubbleSort(wrd,Caline);

        for(int rd=0 ; rd<Caline; rd++)

        {

                if(charchk(wrd[rd]))

                {

                        if(twd(wrd[rd],wrd[rd+1]))

                        {

                                cout<<wrd[rd]<<endl;

                                Ss.get(wrd[rd]).printList();

                                cout<<endl;

                        }

                }

        }

}

//insert new word & definition into the list

void insert()

{

        cout<<"Enter the word you want to add : ";

        cin>> Inwrd;

        cin.ignore();

        cout<<"Enter the Definition for the word(end with [.]) : ";

        cin.getline(HaFile[0].inDefin, 1000, ' . ');

        toLower(Inwrd); // converting user input to lowercase

        ofstream wri("defs.dat");

        for(int d=0; d<Caline; d++)

        {

                wri<<wrd[d];

                wri<<HaFile[d].definition<<endl;

        }

        wri<<Inwrd;

        wri<<" "<<HaFile[0].inDefin<<"."<<endl;

        cout<<"You inserted word successfully"<<endl<<endl;

}

int main()

{

        LinHTable ht;

        readDicf(ht);

        char menu;

        option(); //call the option method

        do{

                cout<<endl<<"Enter your choice[1-5]: ";

                cin>>menu;

                cout<<endl<<endl;

                if(!( menu=='1' ||menu=='2' ||menu=='3'||menu=='4'||menu=='5'))

                {

                        cerr<<"Invalied choice, Please enter between[1-5]"<<endl;

                }

                if(menu=='1')

                {

                        displayAll(ht);

                        option(); //call the option method

                }

                else if(menu=='2')

                {

                        Searchwd(ht);

                        option(); //call the option method

                }

                else if(menu== '3')

                {

                        sortString(ht);

                        option(); //call the option method

                }

                else if(menu=='4')

                {

                        insert();

                        option(); //call the option method

                }

        }while(menu!='5');

        cout<<"\t\t\t------Thank you ----\n";

        cout<<"\t\t---------------*******----------------\n";

        return 0;

}

Assumptions

void Option()

...read more.

Conclusion

Additional general or project specific comments:

We did the best with the time given to us.

Student Signature:

Date:

14-11-2008

Student B

Student Name:

Malshani Nanayakkara

Student Id:

2007020

State what tasks you carried out in the project.

As a group, we implemented the Definition and List classes, as well as the test class for them.

Individually, I implemented the independent hash table.

State what you enjoyed and did not enjoy about teamwork.

Working as a team, we helped each other. But I found a bit discouraging was the fact I found it hard to communicate with my teammate. But in the end, I think we worked through it.

State what you learnt about teamwork.

Working in a team can help you where working individually can not. In a team, you can support and help one another, and the other teammates will help you in return.

State what skills you gained/learnt from undertaking the project.

I learnt about the linked list and how to work with objects and classes. This project required us to be thorough in these two fields, so I now understand how they work.

State any strength about yourself that emerged whilst undertaking the project.

Patience.. It takes a lot of patience to sit and work out a complicated bug and think of an alternative if it still doesn’t work out. Keeping a person’s cool in a troubled time is also an added bonus.

State any weaknesses about yourself that emerged whilst undertaking the project.

Time management. I feel like I should have not delayed working on this project during times where I could have, as I feel like I have rushed through towards the end.

State how you would do things better if you were to undertake the project again.

We could have made a better interface and added extra functions.

Has undertaking this module made you reflect on/change your course.

Nope.

Additional general or project specific comments:

Student Signature:

Date:

14-11-2008

...read more.

This student written piece of work is one of many that can be found in our University Degree Software Engineering section.

Found what you're looking for?

  • Start learning 29% faster today
  • 150,000+ documents available
  • Just £6.99 a month

Not the one? Search for your essay title...
  • Join over 1.2 million students every month
  • Accelerate your learning by 29%
  • Unlimited access from just £6.99 per month

See related essaysSee related essays

Related University Degree Software Engineering essays

  1. software program specification and code for a DVD store

    Hours" "Total cost including VAT is totalcost+VAT" else totalcost=DVDcost*number Display "Total cost including VAT is totalcost+VAT" genre_types Display text messages "Genre types available:" "1. Sci-fi." "2. Crime." "3. Horror." "4. Romance." 2 blank lines DVD_list Call function genre_types Display "Please enter your type" Accept input of choice Switch case 1 Display "1.

  2. Programming Concepts. Andora Video is a small shop selling videos. The owner, Raul, wishes ...

    customer order double indata Used in the process of converting various strings to integer variables String DESIGN PSEUDOCODE Declare vat and discount rates constants Prompt for video ID, Title, Price and Quantity Read inputted values vdSubtotal = vdPrice*vdQty Add vdQty to vdQtyAll Add vdSubtotal to vdSubtotalAll Display string asking if

  1. Systems Development and Implementation

    This moves away from vertical integration and towards horizontal integration, and no single company can provide a complete integrated solution to the customer. Competition forms at the individual layers, and customers (or a system integrator or intermediary) must integrate products together for a complete solution.

  2. MS Office solutions. Fantasy mobiles require: ...

    phone models and the first textbox is updated with the model number selected from the list box. The quantity that is sold is entered into the 'Sold' textbox and the remaining stock is updated when the update button is clicked.

  1. 3ISE517 Internet Application Programming - CGI

    Before moving onto how dynamic pages are created, the following section explains how a static web page would be requested and retrieved from a server. Basic HTTP Requests Every time a user requests a webpage by clicking on a link or simply typing it into the address bar, the web

  2. Complete Section 2 of 3

    Now, 32768 processes might sound like a lot, but for an enterprise-wide Linux server with a database and many connections from a LAN or the Internet, it is a very reasonable number. Database & structures There are options when we consider Linux databases.

  1. Evaluating Websites Usability - comparing 5 websites.

    The contact details are by means of two email addresses on bottom left (again) of home page, they are info@sixtiespress.co.uk & sixtiespress@blueyonder.co.uk 2. There is a reference to ACADEMIC BOOKS BOUGHT ,SMALL COLLECTIONS TO LIBRARIES, GREATER LONDON AND SURREY, ABBEY BOOKS, Phone 02086412212 on centre right of home page, It

  2. Abstract This report is dedicated to demonstrating and critically reviewing new features and developments ...

    They are also working on improving device driver performance, network performance and boot performance. [4] Microsoft also claims several new features on Windows 7 performance [6], including: 1. Fast Boot Up/Shut Down Time 2. Fewer Crashes 3. Less Memory Consumption 4.

  • Over 160,000 pieces
    of student written work
  • Annotated by
    experienced teachers
  • Ideas and feedback to
    improve your own work