EEEE 2067 - Design and Implementation of Engineering Software
Department of Electrical and Electronic Engineering
Coursework Spring 2022/23 Session
“Vending Machine Simulator”
Note: This coursework constitutes 40% of your total assessment in this module
Tasks
Develop a simulator for a high-tech vending machine. On the screen, the user can view the
product selection, price and quantity available. Customer can choose whether to pay using
Wechat or Aliplay. For simplicity, assume that the vending machine only has 9 types of product
item for sales.
The following data should be used to establish the initial state of the machine:
Table 1: Initial Product Inventory
Item Name Price (Yuan) Initial Quantity
Sprite 3 10
Coca Cola 3 10
Pepsi 3 10
Orange 3 10
Lemon Tea 5 10
Coffee 6 10
Milk Tea 6 10
Green Tea 5 10
Mineral Water 2 10
*Note: Initial quantity above is also the maximum quantity the machine can store for each item.
In your program, store the item objects in an array. Design at least 2 classes, a ProductItem
class and a VendingMachine class to implement the simulator. A ProductItem’s object can
be defined using the members listed in Table 2.
Table 2: Members of ProductItem class
No. Function/Variable Description Type
1 itemName The name of the item string
2 itemCost Cost of item in yuan double
3 itemQuantity Quantity of the item available for sale integer
4 Member functions Relevant assessors and mutators
functions. Don’t forget constructor,
destructor and copy constructor.
-
EEEE 2067 - Design and Implementation of Engineering Software
Department of Electrical and Electronic Engineering
The VendingMachine class should have the members listed in Table 3.
Table 3: Members of VendingMachine class
No. Function/variable Description
1 Constructor Constructor which initialises the inventory using the data in Table
1.
2 menuDisplay A function that allows the machine to display product, price and
quantity available. During the purchasing process, the display
should show the status from selection till dispensing of the item.
An option to cancel is also required. There should be a special side
menu that enables the machine operator to enter the
maintenance mode.
3 buyItem A function that allows user to start purchasing. The customer is
allowed to buy more than one item per transaction. Provide the
right condition to handle the purchase when it is out of stock.
4 refill_Item A function under the maintenance mode that allows operator to
refill item. Provide the right condition to prevent mistake. Also take
note of the maximum quantity. This menu is only accessible by the
machine operator.
5 salesReport A function that allows the machine to produce a report of the sales
on the screen and also print the statement to a textfile with
filename “YY-MM-DD.txt”. This menu is only accessible by the
machine operator.
6 Other functions An excellent assignment should include advanced features which
are not stated above. Also, don’t forget to implement copy
constructor and destructor.
Important Notes
(1) Create a UML (class) diagram using PPT and save in PDF format. Please note that member
variables and functions listed in Table 2 and 3 are not exhaustive.
(2) Demonstrate a good understanding on how to use array, pointer, dynamic memory allocation
and access control to member variables and functions in your program.
(3) Provide adequate comments to enhance the readability of your codes.
(4) The simulator should be implemented as a multi-file program (*.h, *.cpp and main.cpp).
(5) Submission deadline is 9 MAY 2023, 5PM. ZIP (not RAR) your codes and UML diagram into
one folder and upload to Moodle. 10% will be deducted per day of late submission.
EEEE 2067 - Design and Implementation of Engineering Software
Department of Electrical and Electronic Engineering
Assessment
Category Marks (%) Description (What is excellent?)
Program
functionality
60 • Program fulfils all requirements, work flawlessly
• Excellent input validation
Coding Practice 20 • Provide a comprehensive UML design
• Superb program structure, logical flow, implementation
of constructor/destructor, copy constructor
• Excellent usage of pointer, array, DMA, access control
and algorithms
Advanced
capabilities,
presentation
and user
experience
20 • Provide functions or features beyond the requirements
given above.
• Excellent user interface and user experience. Very
intuitive/easy to operate like a real vending machine.
Total 100