Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 35

GROUP ASSIGNMENT

CT077-3-2-DSTR

DATA STRUCTURES
PROJECT PROPOSAL

Lecture:
Miss Chong Mien May

Researcher:
Brian Lamri See TP056199
Ong Chong Xian TP055766
Sim Yoke Shin TP059851

APU2F2106CS(IS)

Hand in date: 13th DECEMBER 2021


Hand out date: 25th FEBRUARY 2022
CT077-3-2-DSTR GROUP ASSIGNMENT 2

Contents
Introduction......................................................................................................................................3

Implementation................................................................................................................................5

Result.............................................................................................................................................18

Conclusion.....................................................................................................................................32

References......................................................................................................................................33

Appendix........................................................................................................................................34

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 3

Introduction
This movie ticketing system is developed with two major components that are inventory
and transaction. The inventory has stored the information of the products of GRANDPLEX
cinema such as product name, product id, product price and quantity left of the item. The user
can view, search, add, update and delete the product and product information in the inventory
component. The transaction component has held the purchase record. The purchase details in the
transaction have included the product id, product name, product quantity and the product price.
These purchase details will be summarized into purchase id, buyer name and total price to
display. The details of that particular purchase will be shown by the purchase id has input by the
user.

Array

The data structure array implemented in this system is in the inventory component. An
array is a collection of data stored at contiguous memory locations. The inventory in this system
has been separated into two parts which are movies and products. Both data has been stored in
array format. The reason to separate the movie and products as independent parts is that each
holds different data types of attributes. The reason for using the array to stored inventory data is
because the consideration about the insertion and deletion of the item will be less frequent. As
most of the time, it just needs some adjustment to the quantity and the price of the items.

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 4

Doubly Linked list

The data structure doubly linked list has been implemented in the transaction components
part of the system. The transaction components in the system have basically been separated into
two parts which are purchase and purchase details. Purchase hold attributes such as purchase id,
buyer name and total price. However, purchase details hold the item purchase id, item quantity
and item price. In this system, the purchase details have concatenated into a string which store in
the transaction linked list. This will easier the implementation as linking two linked list by an
attribute is hard to achieve by researchers.

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 5

Implementation
addProduct()/ addMovie()

This addProduct() function is used by the user to add a product to the system. The system will
require the user to input the product name, product category and product quantity. The input of
the user will be stored in the array by function getline(cin, array list[index].variable). The
product Id will be auto-generated by predefined function genProductId() to avoid duplication of
the id. The genProductId() function is used to generate the product id based on the previous
count of id. Then combine the character “P” with the new count of the id. After the new products
data is added, the system will prompt user input to continue to add or back to the main menu. If

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 6

user input is 0 then the function will loop again as it is a while loop else, it will return to the main
menu.

displayProduct()/ displayMovie()

The displayProduct() function is used to display all of the data which is stored inside the Product
Array. It will display all of the product’s details such as product id, product name, product
category, and the quantity of the current product based on the different indexes of the array.

searchProduct()/searchMovie()

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 7

The function of searchProduct() allows the user to input the name of the product to search the
product details. In this case, the researcher has created a small function name findStringProduct()
that is used to compare the name of the product inside the Product Array with the user input. It
will keep looping to compare until the index reached the end of the array. Once the parameters
have matched to each other, the system will display the current line of data as the output of the
function. Since it has put a for loop to search all of the elements of the array, the
findStringProduct() will keep looping until they reach the last element of the array. After
displaying all of the product details which match to the input of the user, the system will prompt
user input to continue to search or back to the main menu. If user input is 0 then the function will
loop again as it is a while loop else, it will return to the main menu.

filterProduct()/filterMovie()

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 8

This function is quite similar to the productSearch() function which also needs to do a similar job
like searching the product based on their categories and displaying the product details which
have the same category to the user’s input option’s category. After displaying all of the product
details which match the input category of the user, the system will back to the main menu.

updateProduct()/updateMovie()

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 9

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 10

The updateProduct() function allow the user to edit the product details of the Product Array
based on the product id that the user has input. The user input will be used by the
getArrayPositionProduct() to intercepts the number of the id from the product id and subtract it
by 1 to get the index of the selected product in the array. Once the system has found the product
id exists in the array, the system will display the current details of the selected product and ask
the user to input the new name, categories and quantity of it. After the user enters all the details,
it will ask the user if he/she wants to confirm editing the current product. Once the user enters 'n'
to indicate that they do not confirm the changes, it will display 'Changes discarded' and break
from this function. As the user confirms to change it, the system will prompt user input to
continue to update another product or back to the main menu. If user input is 0 then the function
will loop again as it is a while loop else, it will return to the main menu.

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 11

sortProduct() /sortMovie()

This sortProduct() function is used for doing the sorting of the Product Array. In this function, it
has asked the user to choose either number ‘1’ for sort the array of products with id arrange; ‘2’
for sort the array of product with the name arrange; ‘3’ for sorting the array of products with the
categories arrange and the last choice is entering the number ‘4’ for sorting the array of product
with the quantity of it. To do the sorting based on the series of choices, the researcher has used
the quick sort algorithm to do the sorting for the Product Array. For using the quick sort
algorithm to sort the Product Array, it needs a partition() and partition_r() function to partition
the Product array to make sure all of the elements to the left of the random pivot element are
smaller than the pivot element, and all the elements at the right of the pivot are larger than the
pivot element according to the different option that the user has chosen. After then, the

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 12

partition_r() and partion() function will be called out recursively to process the left and right
subarray.

deleteProduct() / deleteMovie()

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 13

This deleteProduct() function is used to delete the records of a Product Array. Once this function
runs, it will ask the user to enter the product id that the user wants to delete. The user input will
be used by the getArrayPossitionProduct() to intercepts the number of the id from the product id
and subtract it by 1 to get the index of the selected product in the array. Once it finds that the
selected id exists, it will display the details of the selected product and ask the user to confirm
the deletion of the record. If the user enters 'y', it will delete the data of the array. Otherwise, if
the user enters 'n' to refuse to delete the product, it will break out of the while loop and end this
function. After deleting the product, the system will prompt user input to continue to delete
another product or back to the main menu. If user input is 0 then the function will loop again as it
is a while loop else, it will return to the main menu.

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 14

addPurchase()

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 15

This addPurchase() function is used by the user to place a purchase. The system will run the
addPurchase() function to require the user to input the buyer name to store as the details of the
Transaction linked list. The purchase Id will be auto-generated by predefined function
genTranId() to avoid duplication of the id. The genTranId() function is used to generate the
purchase id based on the previous count of id. Then combine the character “T” with the new
count of the id. After that, the system will use ask the user to enter the product id and quantity
that they want to buy. Once the quantity is available, it will run the addPurchaseItem to adjust
the remending quantity and merge the purchase detail as a string by using changeQuantity()
function. The string of purchase details will be stored as an element inside the Transaction
Linked list by using addPurchaseItem(). After all of the function has run, the system will prompt
user input to continue to add purchase or back to the main menu. If user input is 0 then the
function will loop again as it is a while loop else, it will return to the main menu.

deleteLastTransaction()

The deleteLastTransaction() function is used inside the addPurchase() function to make sure
delete the last input’s user name once the user has entered an invalid input of product or quantity
and quit the current purchase. It will adjust the tail of the linked list to the previous pointer and
empty the next of the current pointer.

viewPurchase()

In the viewPurchase() function, the researcher has created temporary double linked list nodes to
store the pointer of the transaction linked list’s header. If the header isn’t empty, it will display
the data of the linked list which are the purchase id, buyer name, and total price and pass the
pointer to the next node until the pointer reaches an empty node which means that it has reached
the last pointer.

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 16

sortPurchase()

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 17

For sorting the purchases record, the researcher has tried to use the merge sort algorithm to sort
the purchases record. In the sortPurchase() function, it will first determine isn’t the header of the
Transaction’s double linked list is empty. If the linked list is empty, it will just quit the function,
otherwise, it will create two nodes which one of it is points to the header’s pointer of the
Transection and the other is an empty linked list. After creating the two nodes, it will divide the
linked lists into two halves by using FrontBackSplit() function, then it will sort each sub-list
recursively depending on the selection way to sort, and merge the two sorted lists together by
using SortedMerge() function to get a single sorted list.

viewPurchaseDetails()

Once the viewPurchaseDetail() function has run, it will display all of the purchases record and
the purchase details of the purchase record. Since all of the purchase details of each purchase
record is stored as a string and spit by the ‘~~’, so the researcher has used a tokenize() function
to split the string to display all of the records in a clearer way.

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 18

searchPurchaseDetails()

Once the searchPurchaseDetails() function has run, it will get the user input as the parameter to
use for search purchase id inside the transaction linked list, once it is found that the transaction
record exists, it will display the matched purchase records with its purchase details.

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 19

Result
Screenshot of input and output of the system

Figure main menu

The figure above is the screenshot of the output when the program is executing. The console
shows the main menu of the system with the heading Grandplex Cinema let the user identify
which program is it. Then there is a greeting to the user and show the list of the menu which is
Inventory, Transaction and Exit. There is also a navigation guide provided by the system to let
the user know how to use the system.

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 20

Figure inventory menu

1.1

The figure above is the screenshot of the output when the user has typed in “1” in the main
menu. The main menu of inventory will show in the console which let users select the action
wish to perform. If the input is “1” then it will go to the movie main page and when the input is
“2” it will go to the product main page. The user can call the function as stated previously which
is 1,2,3,4…... If the number which didn’t state in the menu is input. There will be an output
“Input error please look carefully to the instruction”.

Figure movie inventory menu

1.1.1

The figure above is the screenshot of the output when the user has typed in “1” in the inventory
main menu. The main menu of movie inventory will show in the console which let users select
the action wish to perform. When the input is “1” it will be going to view the movie which
displays all the movies in inventory. While the input is “2” the action add product will be
triggered which let the user add new movie and movie information to the inventory. If the input
is “3” the edit movie function will be called which allow the user to edit the movie information.
Else if the input is “4” the deleted movie function will be called.

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 21

Figure view movie

1.1.1.1

The figure above is the screenshot of the output when the user has input “1” in the main menu of
the movie inventory. It will show the information of all existing movies in the inventory. Besides
that, the selections of sorting, filter and search have been provided to users. The selection
provided for sorting is by the name and categories of the movie.

Figure sort movie

1.1.1.1.1

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 22

Figure filter movie

1.1.1.1.2

Figure search movie

1.1.1.1.3

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 23

Figure add movie

1.1.1.2

The figure above is the screenshot of the output when the user has input “2” in the main menu of
the movie inventory. It will request the input of the movie name and movie category. After all
the required information has been input from the user. The input information will store in the
inventory and the message “Enter 0 to add again or enter any other character to quit” will be
shown to the user for select new action.

Figure edit movie

1.1.1.3

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 24

The figure above is the screenshot of the output when the user has input “3” in the main menu of
the movie inventory. It will request the input of the movie id. Then the information of the movie
will be shown on the console. After that, the new movie name will be required from the user site
to input to replace the old product information. The system will require the user to enter (y/n) for
double confirmation. If an input is “y” then the message “Enter 0 to update again or enter any
other character to quit” will be shown in the console to the user for select new action.

Figure delete movie

1.1.1.4

The figure above is the screenshot of the output when the user has input “4” in the main menu of
the movie inventory. It will request the input of the movie id. Then the movie id and movie name
will be shown on the console. After that, the system will require the user to enter (y/n) for double
confirmation. If an input is “y” then the product will be deleted and the message “Enter 0 to
delete again or enter any other character to quit” will be shown in the console to the user for
select new action.

Figure product inventory menu

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 25

1.1.2

The figure above is the screenshot of the output when the user has typed in “2” in the inventory
main menu. The main menu of movie inventory will show in the console which let users select
the action wish to perform. When the input is “1” it will be going to view the product which
displays all the products in inventory. While the input is “2” the action add product will be
triggered which let the user add new products and products information to the inventory. If the
input is “3” the edit products function will be called which allow the user to edit the products
information. Else if the input is “4” the deleted product function will be called.

Figure view product

1.1.2.1

The figure above is the screenshot of the output when the user has input “1” in the main menu of
the product inventory. It will show the information of all existing products in the inventory.
Besides that, the selections of sorting, filter and search have been provided to users. The
selection provided for sorting is by the name, categories, quantity and price of the movie.

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 26

Figure sort product

1.1.2.1.4

Figure add product

1.1.2.2

The figure above is the screenshot of the output when the user has input “2” in the main menu of
the products inventory. It will request the input of the product name, product category, product
quantity and product price. After all the required information has been input from the user. The
input information will store in the inventory and the message “Enter 0 to add again or enter any
other character to quit” will be shown to the user for select new action.

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 27

Figure edit product

1.1.2.3

The figure above is the screenshot of the output when the user has input “3” in the main menu of
the product inventory. It will request the input of the product id. Then the information of the
product will be shown on the console. After that, the new product name, product category,
product quantity, product price will be required from the user site to input to replace the old
product information. The system will require the user to enter (y/n) for double confirmation. If
an input is “y” then the message “Enter 0 to update again or enter any other character to quit”
will be shown in the console to the user for select new action.

Figure delete product

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 28

1.1.2.4

The figure above is the screenshot of the output when the user has input “4” in the main menu of
the product inventory. It will request the input of the product id. Then the product id, product
name, product price and product quantity will be shown on the console. After that, the system
will require the user to enter (y/n) for double confirmation. If an input is “y” then the product
will be deleted and the message “Enter 0 to delete again or enter any other character to quit” will
be shown in the console to the user for select new action.

Figure transaction main menu

1.2

The figure above is the screenshot of the output when the user has typed in “2”. The main menu
of transactions will show in the console which let users select the action wish to perform. When
the input is “1” it will be going to view the purchase which displays all the purchases in the
transaction component. While the input is “2” the action add purchase will be triggered which let
the user add new purchase and purchase information to the transaction.

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 29

Figure view purchase

1.2.1

The figure above is the screenshot of the output when the user has input “1” in the main menu of
the transaction. It will show the information of all existing purchases in the inventory. Besides
that, the selection of sorting and view purchase details are selectable. The user can input “1” or
“2” to perform the action sorting and view purchase details.

Figure sort purchase by name

1.2.1.1.1

The figure above is the screenshot of the output when the user has input “1” in the view purchase
menu. The selection provided for sorting is by name and total price of the purchase. After that,
the console will display the sorted purchase details by selected sorting category.

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 30

Figure sort purchase by price

1.2.1.1.2

The figure above is the screenshot of the output when the user has input “1” in the sort purchase
menu. The selection provided for sorting is by buyer name and total price of the purchase. After
that, the console will display the sorted purchase details by selected sorting category.

Figure of purchase details

1.2.1.2

The figure above is the screenshot of the output when the user has input “2” in the view purchase
menu. The selection provided a display of all purchase details. After that, the console will
display the sorted purchase details by selected sorting category.

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 31

Figure of display all purchase details

1.2.1.2.1

Figure of display purchase details by search the id

1.2.1.2.2

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 32

The figure above is the screenshot of the output when the user has input “2” in the main menu of
the purchase details. The information of the product will be shown on the console. Then, it will
request the input of the transaction id of the purchase to search the purchase by its id.

Add purchase

1.2.2

The figure above is the screenshot of the output when the user has input “2” in the main menu of
the transaction. The information of the product will be shown on the console. Then, it will
request the input of the buyer’s name, item id of item wish to purchase, quantities of item
purchase. After that. After the data is saved, the message “Enter 0 to add again or enter any other
character to quit will be shown in the console.

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 33

Conclusion
This system allows users to modify the products and purchases by getting input from the
user. The limitation of the system is it doesn’t provide any graphical user interface (GUI). It may
be difficult to use for beginners and require many inputs from the user side. Besides that, it is
hard to reverse the action if user input has an error. In addition, the missing of the database has
caused the input data cannot be stored once the executed program is killed the data will be lost.
Furthermore, the pointer used in C++ programming is tricky to use. It often makes the system
crash as the incorrect usage of the pointer.

As there are several limitations and disadvantages of the system. Thus, the future created
project should be overcome this problem. As GUI is the most familiar method to operate the
system by non-programmers. Researchers should consider the usability of the actual user. It is
impossible for a movie ticketing system operated by programmers so that a visual representation
that is easier to recognize by the public is better to implement to improve the project. On other
hand, the implementation of a database is extremely important for data storage. So that data
won’t be lost every time when the program ends its session.

During the development of this project, there are a lot of conflict among the researchers
as lack of communication caused the ideas of every member are different. This has caused the
system unusable and provided an error output. To overcome and avoid this mistake to happen
again, researchers have conducted several meetings and developed the system together in the
meeting session. By Implementation the concept of data structure learnt in the class in this
project has improved the practical skills of this module and let researchers gain more knowledge
about data structure and C++ programming.

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 34

References

Level 2 Asia Pacific University of Technology & Innovation 2022


CT077-3-2-DSTR GROUP ASSIGNMENT 35

Appendix
Workload Matrix

Task  Brian Lamri See Ong Chong Xian   Sim Yoke Shin 
TP056199  TP055766  TP059851 
Coding

Inventory 70% 15% 15%

Transaction 20% 40% 40%

Documentation

Introduction 25% 50% 25%

Implementation 30% 30% 40%

Result 35% 30% 35%

Conclusion 25% 50% 25%

Signature

Level 2 Asia Pacific University of Technology & Innovation 2022

You might also like