Mr. Bill's Vending Machine System: Data Structures Report

Verified

Added on  2022/08/18

|20
|2990
|16
Report
AI Summary
This report examines the implementation of data structures and algorithms for Mr. Bill's vegetarian food store, focusing on a vending machine system. It analyzes the problem domain, including IoT system architecture and system coding platforms, and proposes solutions for managing data (add, edit, delete, view) using ArrayLists, accepting sales information via queues, and analyzing sales revenue using stacks. The report includes pseudocode, flowchart diagrams, and complexity analyses for each operation, demonstrating how these data structures can be effectively utilized to create a real-time information system that integrates with the business processes. The report concludes with a discussion on the compatibility of the system with different combinational data structures. The report also discusses the operations of the selected data structures, pseudo code, flow chart and the complexity analysis of the algorithms for the operations.
Document Page
Running head: DATA STRUCTURE AND ALGORITHM
DATA STRUCTURE AND ALGORITHM
Name of the Student
Name of the University
Author Note
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
1DATA STRUCTURE AND ALGORITHM
Table of Contents
Introduction......................................................................................................................................2
Problem Analysis.............................................................................................................................2
Operations........................................................................................................................................4
Manage (add, edit, delete, view)..................................................................................................4
Data Structure..........................................................................................................................4
Pseudo code.............................................................................................................................6
Complexity Analysis.............................................................................................................10
Accept sales information from the vending machines...........................................................10
Analysis the sales revenue for store and/or vending machine...............................................14
Conclusion.....................................................................................................................................17
References......................................................................................................................................18
Document Page
2DATA STRUCTURE AND ALGORITHM
Introduction
The technological advancements have made the human life easier in the present time. The
development of the IoT sensors and device have been widely used in the system. This
advancement has helped many businesses around the world to automate their business (Ju, Kim
and Ahn 2016). This report intends to discuss the proposal for the Mr. Bill’s business of
vegetarian food store using vending machines. The business has its main kitchen in Yishun
Industrial Park. The company is supposed to improve their business process implementing the
real time information system. This report discusses the problem analysis of the implementation,
along with the selection of the data structures for variable functionality of the system. the
functionality of the systems are the managing data (add, edit, vie and delete), accepting the sales
information from the various places where the vending machines are installed on different
locations and analyzing the revenue of the vending machine and store using calculations. The
Report also covers the operations of the selected data structures, pseudo code, flow chart and the
complexity analysis of the algorithms for the operations. Lastly the report concludes with the
compatibility of the system with the different combinational data structures.
Problem Analysis
A vegetarian food store chain system based in the central kitchen in Yishun Industrial
Park. Owner of the system Mr. Bill wanted to improve the system with the help of the IoT. Sky,
business advisor of the company has suggested to implement vending machines to automate the
services. The system is supposed to be a real time information system to integrate with the
business processes and ending machines (Kunze and Weske 2016). The problem domain for this
Document Page
3DATA STRUCTURE AND ALGORITHM
approach can be categorized according to the coding-platforms and system architecture which
are described below:
a. IoT System Architecture: The IoT systems are connected by integrating with the
processes and digital connection. The Proposed system is supposed to achieve simple
functionalities, in which the IoT system will run tasks such as accessing information,
sensors for tracking stock and balance etc. The Architecture will include the components
and objects of the system to work collaboratively (Solano 2017). The stored data will be
about the information of the vending machines, stores, products, top-up of stocks and IoT
transmission. The System architecture needs to have to fulfill the real-time calculation in
the system (Da Xu 2014). The input entered in the machine will get processed in a finite
time period.
b. System Coding Platform: For the real time computing, it will be better if the system
should use the memory more than the storage. The data structures are good to use in this
scenario to store and access the data as the timeliness of the system functions is low. The
coding platform requires the languages that supports object-oriented approach (Cai, Liu
and Xie 2016). In this approach, the system can be modelled with the UML (Unified
modelling Language) where it becomes easier to code. The design can help in the
reusability of the code blocks, privacy, accessibility and scheduling of the required
resources. The Pseudo codes and flow chart diagram is better option before doing the
actual code.
The main Problem domain for implementing this system is to implement the data in a
relational way without implementing the relational database management tools (Alzahrani 2016).
The Object-oriented platform is selected for the development where the indexing in arrays can be
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
4DATA STRUCTURE AND ALGORITHM
used for establishing relations between the attributes. However, the data can be searched by the
values in the ArrayList.
Operations
Manage (add, edit, delete, view)
Using this operation information can be stored in the system. Apart from the storing,
added data can be edited, deleted and displayed from the data structure. For using operations, the
important information of the business can be stored in the system. The data structured used for
this operation along with the, justification and operation of the pseudo code are explained below:
Data Structure
The data structure selected for the manage operation is ArrayList which is the link list
implementation of the arrays. It is a part of the collection framework in Java (Reges and Stepp
2014). The arrays are the dynamic and powerful in the programs where manipulation in the array
is required. Some of the properties of the ArrayLists are listed below:
a. ArraysLists can inherit the properties of the class in which they are used.
b. It can be resizable when the collection grows or shrunk by adding and removing
objects from the class.
c. It allows to randomly access any list.
d. It needs a wrapper classes for using the primitive data types.
Document Page
5DATA STRUCTURE AND ALGORITHM
Figure 1: Flowchart diagram for the ArrayList Implementation
It has many important methods such as add() for adding new elements, get() to refer for a
index number and update the value by using set() method. The elements in the ArrayList can
also be removed using the remove() method and by referring to the index number of the item
(Gaddis, Bhattacharjee and Mukherjee 2014).
Document Page
6DATA STRUCTURE AND ALGORITHM
Pseudo code
class VendingArrayList
{
int n=3;
// the datatype class
class Data
{
// global variables of the class
int Machineid;
int Locationid;
String Address;
// Construct
Data(int Machineid, int Locationid, String Address)
{
// initializeinput variable
// function to the global variable of the class
this.Machineid = Machineid;
this.Locationid = Locationid;
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
7DATA STRUCTURE AND ALGORITHM
this.Address = Address;
}
}
public static void main(String args[])
{
// custom input
int Machineid[] = {101, 102, 103};
int Locationid[] = {001, 002,003};
String Address[] = {“Address1", "Address2", "Address3"};
};
// Create an object
VendingArrayList custom = new VendingArrayList();
// call function to add
vending.addValues(Machineid,Locationid,Address);
}
public void addValues(int Machineid[], int Locationid[], String Address[])
Document Page
8DATA STRUCTURE AND ALGORITHM
{
// local custom arraylist of data type
// Data having (int, int ,String) type
// from the class
ArrayList<Data> list=new ArrayList<>();
for (int i = 0; i < n; i++)
{
// create an object and send values to the
// constructor to be saved in the Data class
list.add(new Data(Machineid[i], Locationid[i], address[i]));
}
// Display (view data)
// the custom arraylist
printValues(list);
}
Document Page
9DATA STRUCTURE AND ALGORITHM
public void printValues(ArrayList<Data> list)
{
// list- the custom arraylist is sent from
// previous function
for (int i = 0; i < n; i++)
{
// the data received from arraylist is of Data type
// which is custom (int, String, int, long)
// based on class Data
Data data = list.get(i);
// data variable of type Data has four primitive datatypes
System.out.println(data.Machineid+" "+data.Locationid+" "
+data.Address);
}
}
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
10DATA STRUCTURE AND ALGORITHM
}
Complexity Analysis
Insertion
For insertion at a particular index, the time complexity of the arraylist will be O(N) as it is a
linear data structure (Jönsson and Fransson 2018). Due to extra steps in adding new items in
arraylist and copying the value sin the index multiple inserts occur.
View
Arrayslist is backed by an array in Java hence, the get(index) method will have a constant time to
perform the operation which will be O(1) (Goodrich, Tamassia and Goldwasser 2014). Without
travelling through the whole array, the value can be found by indexing only. However, by value
the complexity becomes O(n).
Remove and Edit
To remove/edit a value at a given index in an Arraylist has the time complexity of O(1) similarly
due to the random access of the any index directly. However, by value the complexity becomes
O(n).
Accept sales information from the vending machines
Using this operation, the system of the vending machine should allow to send the real
time information to the main kitchen. It will accept the data from different sensors and send it
sequentially.
Data Structure
Document Page
11DATA STRUCTURE AND ALGORITHM
The Data structure selected for the accessing the sales information is the array
implementation of the queue (Joyce and Weems 2016). The stored information in the arraylists
has indexes for different values. Using the arrays, the queue can be inserted with the information
at the vending machine end the value will be received on the main kitchen end. It requires an
array for size of n two variables for front and rear (initialized 0) for a queue implementation
using arrays (Huang, Lim and Cong 2014). The insertion of the data in queue is called enqueue
and retrieval is called dequeue.
Figure 2: Queue operation
chevron_up_icon
1 out of 20
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]