0% found this document useful (0 votes)
6 views2 pages

Before Submission

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Before Submission

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

ASM02 INSTRUCTIONS

Follow the steps below to complete ASM02:


1. Create a folder to save given projects, e.g. CSD_given (1). Download the given materials to (1).
2. Complete the requirements of the test.
3. Before submission:
 Clean and Build Project (Shift+F11),
 Then rename the folder dist to run. (If the folder run already exists, delete it before
renaming).
4. Submission:
 The folder should be named like this:
RollNumber_StudentName_ASMCode
Ex:
SE170351_TranVanAnh_ASM02
SE170351-TranVanAnh-ASM02
 Then zip it to ZIP FILE (Do not use RAR).
 Now you can submit to LMS.
5. Do not use accented Vietnamese when writing comments in programs.
6. Do not add new import statement(s) to given files.
7. Software tools must be used: NetBeans IDE 8.x and Java JDK 1.8.
If at least one of the above requirements is not followed, the exam will get ZERO.
 Notes:
o The input and expected output below are only used to test your codes.
o The input and expected output in the real testcases (for marking) are different with
in the examples below.
o Do not hardcode with the given expected results.

Troubleshooting:
If the given project (e.g. Q1) runs with error, you need to run "Clean and Build Project"
(Shift+F11). If still error, try to rename or copy the project to other one, e.g. from Q1 to Q1X or
Q1Y.

The given files already contain statements to implement a program for managing a computer store.
The structure of the main classes is as follows:
Class Item: contains information about a Item object, including name, quantity, and price.
- Class Node: includes a Item object and a next pointer for linking.
- Class ItemList: is a singly linked list that manages regular Nodes with complete
information. This class plays the role of managing all items in the Store.
- Class RequestQueue: is a queue structure (implemented as a linked list), where the
component data of the Nodes only contains the name and quantity. This means that the
corresponding request is to purchase an item with a specific name and quantity.
- Class ComputerStore: is the main class of the program, containing a ItemList used to store
data on the items currently available in the store and a RequestQueue corresponding to a
queue of people wanting to make purchases.
Students are required to carefully read the provided code segments to fully understand the
relationships between the classes and the functions within each class. The specific task of the test is
to execute the following requirements:
a. f1(): To complete the requirement f1, students need to fulfill two specific tasks: implement
the function addLast() in the ItemList structure and the function enQueue() (similar to
addLast) in the RequestQueue structure. The expected output used to test your code are as
follows:
Data Item: (Computer,10,2000) (Keyboard,10,300) (Mouse,10,100) (Tablet,10,3000)
(Phone,10,3000) (Monitor,10,2000)
1
Request : (Computer,2) (Keyboard,5) (Tablet,3) (Monitor,12) (Mouse,2)

b. f2(): To complete the requirement f2, students need to perform two specific tasks:
implement the deQueue() function of the RequestQueue structure, then use the returned
result to execute the purchase action for the f2 function. The purchase action can be
implemented directly within the body of the f2 function or executed outside of the function
by a helper function, which will then be called by f2. The purchase action consists of two
steps:
o First, search for the item (name) to be purchased. If found, proceed to step 2.
o If the quantity (quantity) available in the ItemList is not less than the quantity to
be purchased, perform the purchase action: update the remaining quantity in the
ItemList .
The expected output used to test your code are as follows:
Data Item: (Computer,10,2000) (Keyboard,10,300) (Mouse,10,100) (Tablet,10,3000)
(Phone,10,3000) (Monitor,10,2000)
Request : (Computer,2) (Keyboard,5) (Tablet,3) (Monitor,12) (Mouse,2)
Data Item: (Computer,8,2000) (Keyboard,10,300) (Mouse,10,100) (Tablet,10,3000)
(Phone,10,3000) (Monitor,10,2000)
Request : (Keyboard,5) (Tablet,3) (Monitor,12) (Mouse,2)
c. f3(): Perform the pair of operations deQueue() and purchase for all items in the
RequestQueue. The expected output used to test your code are as follows:
Data Item: (Computer,10,2000) (Keyboard,10,300) (Mouse,10,100) (Tablet,10,3000)
(Phone,10,3000) (Monitor,10,2000)
Request : (Computer,2) (Keyboard,5) (Tablet,3) (Monitor,12) (Mouse,2)
Data Item: (Computer,8,2000) (Keyboard,5,300) (Mouse,8,100) (Tablet,7,3000)
(Phone,10,3000) (Monitor,10,2000)
Request : Empty
d. f4(): Perform the pair of actions, deQueue() and purchase, for all the items in the
RequestQueue and calculate the total revenue. The revenue (money) from selling an item
is equal to the multiplication of the quantity purchased and the selling price. The expected
output used to test your code are as follows:
Data Item: (Computer,10,2000) (Keyboard,10,300) (Mouse,10,100) (Tablet,10,3000)
(Phone,10,3000) (Monitor,10,2000)
Request : (Computer,2) (Keyboard,5) (Tablet,3) (Monitor,12) (Mouse,2)
Money : 14700

You might also like