Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Jordan University of Science and Technology

Computer Science Department


HSS 211 CS Data Structures
Second Semester 2023-2024
Assignment # 1: Unordered Linked List

Objective

In this assignment, you will


 Implement a customized version of the unordered linked list.

Submitting Assignments:
Complete and submit your solution on (CS211 Practical e-learning page), using one of the
following upload links according to your own section before the deadline (Late assignments will
not be graded).

 Assignment1-upload link for Sec1-Dr Rasha (STT 8:30-9:30)


 Assignment1-upload link for Sec3-Dr Rasha (STT 9:30-10:30)
 Assignment1-upload link for Sec5-Dr Rasha (STT 10:30-11:30)
 Assignment1-upload link for Sec6-Ms Noor (STT 10:30-11:30)
 Assignment1-upload link for Sec7-Ms Noor (STT 11:30-12:30)
 Assignment1-upload link for Sec8-Dr Omar (MW 10:00-11:30)
 Assignment1-upload link for Sec9-Dr Omar (MW 11:30-01:00)

Once finished, compress your source code (Header and CPP files) and upload it to the assignment
link on e‐learning. Note: Your assignment must be compiled to be graded. Partial credit will not
be given for the code with syntax errors.

Grading.
The total grade is going to be out of 80, you must successfully discuss your solution with a TA to
get your grades. Feel free to contact the TA and ask her about the assignment if there is
anything not clear to you.

TAs information:

1. Ms Hajar Shehabat: hmshehabat@just.edu.jo (sections 1, 3 and 5)


2. Ms Enas Bani Younis: ehbaniyounis@just.edu.jo (sections 6, 7, 8, and 9)

HSS 211 Assignment # 1 Dr. Rasha Obeidat


Description
In the retail industry, inventory management is important for maintaining the right balance of
stock on hand. For this assignment, you'll be designing and implementing a custom linked list to
manage the inventory of clothing products. The goal of this system is to efficiently keep track of
various items in stock, including their details and quantities, enabling easy access, searching for,
addition, and removal of inventory items. This system can be crucial for retail store operations,
ensuring that products are adequately stocked and available for customers.

In the assignment, you are supposed to implement the classes ClothingItemType,


ClothingNodeType and ClothingListType. Their specifications are shown in the following UMLs
(Figures 1, 2, and 3).
 ClothingItemType is the class that defines the attributes of a clothing item.
 ClothingNodeType This class serves as the building block for the linked list. Each object
of the class ClothingNodeType contains a clothing Item (an object of the class
ClothingItemType ) and a pointer called link that points to the next node in the list.
 ClothingListType. This class implements the functionality of the linked list tailored for
managing a clothing inventory. It includes methods for adding new items, removing
items, updating stock quantities, searching for items by name, or price, and counting
items of a specific category.

class ClothingItemType ( 10 pts)


//(4 pts) Data members definition
+clothingItemID: string //A unique identifier for the clothing item.
+Name: string //The name or title of the clothing item, such as shirt, T-shirt, short,
pants, skirts, hats, boots, sandals etc.
+category: string //The category this clothing item belongs to such as tops, bottoms,
activewear, footwear, accessories etc.
+price: float //The retail price of the clothing item in JD.
+quantityInStock: int //The current quantity of the item available in stock
+ClothingItemType () //(1 pt) Default constructor, you can keep it empty, but should be
added
+ ClothingItemType (string, string, string, float, int) // (2 pts) Parameterized constructor
that sets the values of the passed parameters to the corresponding member variables.

HSS 211 Assignment # 1 Dr. Rasha Obeidat


+displayInfo(): void //(3 pt) Prints the information of the clothing item neatly on one line
by printing each variable’s name followed by its value. For example: [clothingItemID:123,
Name: Jeans, category: bottom, price :25, quantityInStock:100] ”
Figure 1: UML box of the class ClothingItemType

class ClothingNodeType //( 5 pts)


+ clothingItem: ClothingItemType // object that describes a clothing item (the info
of the node)
+ link: ClothingNodeType
Figure 2: UML box of the class ClothingNodeType

class ClothingListType //(45 pt)


- first: ClothingNodeType *
- last: ClothingNodeType *
- count: int
+ ClothingListType () //( 1 pts) default constructor
+ ~ ClothingListType ( ) //( 1 pts) destructor
+ destroyList(): void // (2 pts) Delete all the nodes from the list.
+ length(); int // ( 1 pts) Return the number of clothing in the list

Insert and delete Functions


+ insertClothingItem( const ClothingItemType & newItem): void // (5 pts) Insert a clothing
record to the end of the linked list if the item to be added is not in the list, if it is already in the
list ( same clothingItemID), print a message stating that an item with the same id is already in the
list.
+deleteClothingItem( const string & deleteItemID): void // (5 pts) delete the clothing node that
has clothingItemID equals to the value of deleteItemID. If the item is not in the list, the program
should output a message showing that the item to be deleted doesn’t exist in the list.

Search Functions:
+ searchByClothingItemID (const string & searchName) : bool //(5 pts) Returns true if an item is
in the list using its clothingItemID, otherwise the value false is returned.
+ searchByPrice ( float searchprice) : bool //(5 pts) Returns true if there are items in the list
cheaper than the passed price, otherwise the value false is returned.

count Functions:

+ CountByCategory( const string & ItemCategory): int // ( 5 pts) returns how many clothing
items of a specific ItemCategory exist in the list.

Print Functions:
+ print (): void //( 3 pts) Prints the information of all items in the clothing list neatly and
clearly.

HSS 211 Assignment # 1 Dr. Rasha Obeidat


+ printRunningOut( int quant ): void // ( 5 pts) print all the clothing items that have
quantityInStock less than or equal to quant.

+ printFront(): void //(1 pts) Function to print the information of the first clothing item in
the list by calling the function ClothingItemType::displayInfo().
+ printBack() : void //(1 pts) Function to print the information of the last clothing item in
the list by calling the function ClothingItemType::displayInfo().

Data Adjusting functions


+ updateStock( const string & ItemId , int quantity): void // ( 5 pts) Adjusts the stock
quantity for a given clothing items by setting the value of the quantityInStock of the item (with
clothingItemID equals to ItemId) to quantity.

Figure 3: UML box of the class ClothingListType

Important notes:
1. On e-learning, you can find the header and the cpp files that you are supposed to place your
code inside. The cout sentences inside the file testProg.cpp may help you to design a
comprehensive list of test items. Once you’ve finished, please compress your source code
(Header and CPP files) and upload it to the assignment link on e‐learning.
2. Please add the time complexity of each function as a comment before the function header.
3. Please Implement the function outside the class.
4. Please implement the classes and their functions as specified in the UML (by the green
comment).
5. The code Should Be customized from the code you learned in the course, specifically the
classes linkedListType and unorderedLinkedListType, the code that diverges significantly
from the code inside these classes is not an acceptable solution.
6. You must write a code to test the functions you’ve implemented. You are responsible for
designing a test code that helps us to see if your functions are implemented properly. In the
test code, you’ll define an object of the class ClothingListType and call the functions. You
need to place your test code inside the file “testProg.cpp” which contains the “main
function”. During grading, we are also going to use our one test code to check if your code
is written properly or not. A sample test run is presented in the sample screenshots below.

first last

clothingItemID:124 clothingItemID:154
clothingItemID:123 clothingItemID:154
Name: T-shirt Name: skirt
Name: Jeans Name: Boot
Category: bottom
Category: Top
Category: Footwear … Category: bottom
price: 23
price :15
price :25 price: 30
quantityInStock:20 quantityInStock:17
quantityInStock:100 quantityInStock:45

Figure 4: Sample clothing List.

HSS 211 Assignment # 1 Dr. Rasha Obeidat


Screenshots of sample test cases

HSS 211 Assignment # 1 Dr. Rasha Obeidat


HSS 211 Assignment # 1 Dr. Rasha Obeidat
Grade distribution:
 Writing a comprehensive test code (inside the file “testProg.cpp” which contains the
“main function" (: 20 points
 The rest of the points are divided as shown in the UML boxes.

Good luck

HSS 211 Assignment # 1 Dr. Rasha Obeidat

You might also like