Database and Data Structure Assignment

download Database and Data Structure Assignment

of 20

Transcript of Database and Data Structure Assignment

  • 8/12/2019 Database and Data Structure Assignment

    1/20

    1 | P a g e

    DATABASE AND DATA STRUCTURE ASSIGNMENT

    ASSIGNMENT TYPE: GROUP ASSIGNMENT

    ASSIGNMENT CODE: AAPP001-3-2ASSIGNMENT TITLE: LINKED LIST AND STACKS

    NAME: TINAGARAJ A/L MORGAN (TP025931)

    TULASINATAN A/L MUTHUALAGU (TP026049)

    SRI SARANGGA RAJA A/L VELAN (TP025845)

    YEHKHARAJ A/L TAMILARASU (TP025637)

    INTAKE: UCD2F1209-DIT (SE)

    LECTURER: MADAM. SEETHA LECTHUMI

    DATE: 13/05/2013

  • 8/12/2019 Database and Data Structure Assignment

    2/20

    2 | P a g e

    WORKLOAD MATRIX

    Topic Gr ou p M embe r (E ff or t (%))

    Tinagaraj(TP025931)

    Sri SaranggaRaja

    (TP025845)

    Tulasinatan(TP026049)

    Yehkharaj(TP025637)

    1. Introduction to the project 25% 25% 25% 25%

    2. Workload Matrix 25% 25% 25% 25%

    3. Source-Codes 25% 25% 25% 25%

    4.Screen design 25% 25% 25% 25%

    5. Testing 25% 25% 25% 25%

    6. Reference 25% 25% 25% 25%

    7. Group Effort 25% 25% 25% 25%

  • 8/12/2019 Database and Data Structure Assignment

    3/20

    3 | P a g e

    CONTENTS

    WORKLOAD MATRIX ..................................................................................................................................... 2

    ACKNOWLEDGEMENT ................................................................................................................................... 4

    INTRODUCTION ............................................................................................................................................. 5

    SECTION A: LINKED LIST ............................................................................................................................ 5

    SECTION B: STACKS ................................................................................................................................... 6

    DATA STRUCTURE ......................................................................................................................................... 7

    PART A - LINKED LIST ................................................................................................................................. 7

    PART B - STACKS ...................................................................................................................................... 11

    SCREEN SHOTS ............................................................................................................................................ 12

    PART A - LINKED LIST ............................................................................................................................... 12

    PART B - STACKS ...................................................................................................................................... 16

    CONCLUSION ............................................................................................................................................... 17

    REFERENCE .................................................................................................................................................. 18

    ASSIGNMENT MARKING SCHEME ............................................................................................................... 19

  • 8/12/2019 Database and Data Structure Assignment

    4/20

    4 | P a g e

    ACKNOWLEDGEMENT

    We would like to express our deepest appreciation to all those who provided me the possibility to

    complete this assignment. A special gratitude we give to our DBDS Lecturer, Madam.Seetha

    Lecthumi whose contribution in stimulating suggestions and encouragement helped us to

    coordinate our assignment especially in the system part.

    Finally, an honorable mention goes to our families and friends for their understandings and

    supports me in completing this assignment. Without helps of the particular that mentioned above,

    we could face many difficulties while doing this.

    Tulasinatan Muthualagu

    Tinagaraj Morgan

    Sri Sarangga Raja Velan

    Yehkharaj Tamilarasu

  • 8/12/2019 Database and Data Structure Assignment

    5/20

    5 | P a g e

    INTRODUCTION

    This project includes of two parts, Part A (Linked list) and Part B (Stack). This introduction

    portion will debate concerning these two cases in finished and the rest of the documentation will

    debate what the assignment is all about.

    SECTION A: LINKED LIST

    Stack is an abstract data type and data structure based on the principle of Last in First

    Out(LIFO). Stack is used in computer science such as algorithms, compilers, keeping track of

    procedure calls and operating systems.

    Stacks have some useful terminology associated with them:

    Push To add an element to the stack Pop To remove an element from the stock

    Peek To look at elements in the stack without removing them LIFO Refers to the last in, first out behavior of the stack FILO Equivalent to LIFO

  • 8/12/2019 Database and Data Structure Assignment

    6/20

    6 | P a g e

    SECTION B: STACKS

    Link List

    Linked list is one of the frank data constructions, and can be utilized to implement

    supplementary data structures.Data structures can be added to or removed from the linked

    list during execution. There several types of linked list operations append a node to the

    end of the list; insert a node within the list; traverse the linked list; delete a node.

  • 8/12/2019 Database and Data Structure Assignment

    7/20

    7 | P a g e

    DATA STRUCTURE

    PART A - LINKED LIST

    Source File

    #include #include #include

    #include

    struct Transaction {

    char name[50];char numb[50];char more[99];

    int prev;int next;

    }trans[100]={0};int count = 0;int start = 0;int terma = 0;

    #include "Methods.h" int main() {

    int choice; populate();printf( "Welcome to Our System\n\n\n" );do {

    system( "pause && cls" );printf( "Main Menu\n\n\n" );printf( "1. Add to Start\n" );printf( "2. Add to End\n" );printf( "3. Print List\n" );printf( "4. Remove a Node\n" );

    printf( "\n0. Quit System\n" );printf( "\n\n Enter choice: " );scanf( "%d", &choice);fflush( stdin );system( "cls" );

    switch (choice){

    case 1: addToStart(); break ;

  • 8/12/2019 Database and Data Structure Assignment

    8/20

    8 | P a g e

    case 2: addToEnd(); break ;case 3: printList(); break ;case 4: removeNodeAt(); break ;default : choice=0; break ;

    }fflush( stdin );

    } while (choice>0);printf( "Thanks\n\n" );system( "pause" );return 0;

    }

    Header File

    void populate();void addToStart();void addToEnd();void printList();void removeNodeAt();

    void addToStart() {if (count>0) {

    trans[start].prev = count;}trans[count].next = start;trans[start=count].prev = -1;printf( "----------------------------\n" );printf( "Add to Start\n" );

    printf( "----------------------------\n" );printf( "\n\t Customer name: " );scanf( "%s" , trans[count].name);

    printf( "\n\t Customer number: " );scanf( "%s" , trans[count].numb);fflush( stdin );printf( "\n\t Trans.details: " );gets(trans[count].more);count++;

    }

    void addToEnd() {if (count>0) {

    trans[terma].next = count;}trans[count].prev = terma;trans[terma=count].next = -1;printf( "----------------------------\n" );printf( "Add to End\n" );

    printf( "----------------------------\n" );printf( "\n\t Customer name: " );scanf( "%s" , trans[count].name);

    printf( "\n\t Customer number: " );scanf( "%s" , trans[count].numb);

  • 8/12/2019 Database and Data Structure Assignment

    9/20

    9 | P a g e

    fflush( stdin );printf( "\n\t Trans.details: " );gets(trans[count].more);count++;

    }

    void printList() { int i;printf( "----------------------------\n" );printf( "Customer Records : name\tNumber\tTrans. details\n\n" );

    printf( "----------------------------\n" );if (count

  • 8/12/2019 Database and Data Structure Assignment

    10/20

  • 8/12/2019 Database and Data Structure Assignment

    11/20

    11 | P a g e

    PART B - STACKS

    #include #include #include #include

    struct Stacker {

    int item[5];

    int at;} box[5]={0};

    int main() { int i, j, bin, item;printf( "Welcome to Our System\n\n" );printf( "bin item. E.g.: 2 111\n" );do {

    fflush( stdin ); //printf("\n"); //printf(" \n \t Customer: "); scanf( "%d %d", &bin, &item);

    if (bin=5){

    printf( "Invalid bin\n\n" );return -1;

    }else if (item>0){

    int *at = &box[bin].at;*at = *at>3 ? 0 : *at+1;box[bin].item[*at] = item;

    }} while (item>0);system( "cls" ); printf( "Bin\tItem\n\n" );for (i=0; i

  • 8/12/2019 Database and Data Structure Assignment

    12/20

    12 | P a g e

    SCREEN SHOTS

    PART A - LINKED LIST

    Figure 1: Customer Entry Form

    This is the customer entry form of the Part A program, which is Customer Transaction Application. Thisform is where the users who want to enter the program.

  • 8/12/2019 Database and Data Structure Assignment

    13/20

    13 | P a g e

    Figure 2: Customer Data

    This form is where the user enters the customer data in to the program.

    Figure 3: Main Menu

    This is the main menu which provides option to users who want to use the program.

  • 8/12/2019 Database and Data Structure Assignment

    14/20

  • 8/12/2019 Database and Data Structure Assignment

    15/20

    15 | P a g e

    Figure 6: Print Data of All Customers

    In this section, customer transaction will printed out.

    Figure 5: Remove Customer Node

    In this section, customer transaction will be deleted from the node.

  • 8/12/2019 Database and Data Structure Assignment

    16/20

    16 | P a g e

    PART B - STACKS

    Figure 6: Items and Bins Entries

    In this section, bin item and bin entries will be entered.

    Figure 7: Stack Concept Applied to Process items in Bins

    This is the output part after all the bin items have been entered.

  • 8/12/2019 Database and Data Structure Assignment

    17/20

    17 | P a g e

    CONCLUSION

    The project has been finished successfully within the time frame that was allocated for the

    system. The project reserved with the given specifications that we mentioned in the scope of the

    project.

    The team managed to work together with a great efficiency where each would cover the other

    members w eakness and therefore helping the finished team member to complete this project.

    We have been able to considerably benefit from the strengths that the other team members

    processed and thus helping us individually also to do well in the subject. We have been given a

    chance across this project to all the theoretical knowledge that we obtained across the class

    sessions and apply them in a useful sense by doing this assignment.

  • 8/12/2019 Database and Data Structure Assignment

    18/20

    18 | P a g e

    REFERENCE

    Cprogramming.com (2011) Linked Lists in C++ Tutorial - Cprogramming.com . [online]

    Available at: http://www.cprogramming.com/tutorial/lesson15.html [Accessed: 10 April 2013].

    Cs.auckland.ac.nz (1998) Data Structures and Algorithms: Stacks . [online] Available at:

    http://www.cs.auckland.ac.nz/software/AlgAnim/stacks.html [Accessed: 13 April 2013].

    Greenteapress.com (n.d.) Chapter 17: Linked lists . [online] Available at:

    http://www.greenteapress.com/thinkpython/thinkCSpy/html/chap17.html [Accessed: 17 April

    2013].

    Unknown. (2013) Untitled. [online] Available at:http://cslibrary.stanford.edu/103/LinkedListBasics.pdf [Accessed: 20 April 2013].

    Unknown. (2013) Untitled. [online] Available at:

    http://www.dauniv.ac.in/downloads/EmbsysRevEd_PPTs/Chap_5Lesson04EmsysNewstacks.pdf

    [Accessed: 26 April 2013].

    wiziq (n.d.) STACKS IN DATA STRUCTURE . [online] Available at:

    http://www.wiziq.com/tutorial/13556-STACKS-IN-DATA-STRUCTURE [Accessed: 10 May

    2013].

  • 8/12/2019 Database and Data Structure Assignment

    19/20

    19 | P a g e

    ASSIGNMENT MARKING SCHEME

    Group:

    Student Name/ ID: Tinagaraj A/L Morgan (TP025931)

    Tulasinatan A/L Muthualagu (TP026049)

    Sri Sarangga Raja A/L Velan (TP025845)

    Criteria Marks Comments

    Implementation (11 marks)

    Program logic (3) Validation checks (3) Expected results (3) Workable system (2)

    Efficiency of code (6 marks)

    Efficient memory utilisation (2) Modular/Compact program (2)

    No use of unnecessary globalvars, goto statements etc (2)

    Comprehension (9 marks)

    Explanation of code (3) Capability to debug errors (3) Logic justification (3)

    . . .

    Assignment contribution (4 marks)

    Workload distribution (2) Initiative taken (2)

    . .

    Total: 30 marks ..

  • 8/12/2019 Database and Data Structure Assignment

    20/20