Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A laundry shop offers washing service to its customers. It welcomes its customers every day to bring their laundry in or take it out after
A laundry shop offers washing service to its customers. It welcomes its customers every day to bring their laundry
in or take it out after its being washed. The shop has only one washing machine that takes only pieces of
clothing at a time. Once customers bring their clothing, the shop worker starts stacking it in small boxes that he
queues the order of clothing in one box does not matter, the order of boxes is what matters See the figure
below for illustration. If the box is full it will be loaded into the washing machine, but if the machine is full, a new
empty box is used and queued.
HSS Assignment # Dr Omar Almousa
Implementation points:
A Define a simple data type struct for clothing that has only three public member variables id
cost and owner. The id is a unique integer given for each clothing for identification. The cost is a
float number for the cost of the laundry. Finally, owner is a string to store the name of the owner. Save
the clothing struct in a header file and include it in linkedQueue.h file. points
To help you: The header file is created for you; you only need to insert the struct definition of
clothing lines of code!
B To store the clothing for the next wash, a stack of clothing a list or a queue will do but they are too
fancy for such a purpose since no need for their extra functionalities at all The stack maximum size must
be as you can tell from the specifications above.
To help you: The file mystackh is changed so every time a stack is created using the default
constructor then the maxStackSize is set to
C To maintain order for the stacks, define a queue of stacks, let us call it any queue of stacks of clothing Q
to make our explanation smoother.
To help you: The queue Q of stacks is defined for you in the main function in the file called
solution.cpp in which you will add the functions described in EF and G below.
D Add a member function call it addClothingto the class linkedQueueType. This function has a
single parameter of type clothing. The function adds the clothing to the last stack in the calling queue,
if the stack is full, the clothing will be added to a new stack that is added to the rear of the calling queue.
If the calling queue is empty, the same from previous case must occur. points
E Add a nonmember function call it wash that simulates washing a batch from Q This function takes Q
as a parameter, it empties the first stack from Q into the washing machine and remove it from Q If Q is
empty, the function gives the message There is nothing to wash!! Have a nap, or start
marketing!! If the first stack in Q is not full has less then pieces of clothing the function gives the
messages The only batch is not full, let us wait! otherwise, the function prints the washed
clothing. points
F Add a nonmember function call it print that takes Q as a parameter, prints the details of Q If Q is
empty, the function gives the message Otherwise, the function will print the details id owner,
price for each clothing piece in each stack in Q After that the function prints the number of stacks in Q
points
G Add a nonmember function call it bill to show the bill for a customer by hisher name. This function
takes two parameters: Q and the name of the customerstring If Q is empty, a message stating that
must be shown. Otherwise, the function must summon the prices for all pieces of clothing owned by the
customer in every stack of Q in the following form The customer Ali has clothing pieces
that costs For customer with nothing in the queue, it is fine to have zeros in the count of
pieces or the total cost. This function MUST NOT CHANGE Q neither by contents nor by nature queue;
therefore, it is recommended to have a copy of Q inside the function, and empty the copy not the
parameter. points
HSS Assignment # Dr Omar Almousa
How to start:
Download the compressed file startrar from Moodle, then extract it It will result in a folder with
files: clothing.h linkedQueue.h solution.cpp myStack.h queueADT.h and
stackADT.hThe files in red are not to be touched!
In the file clothing.h add the definition of struct clothing as specified in A above to get
points.
In the file linkedQueue.h add an implementation for addClothing function as specified in D
above. Remember that you need to add its prototype inside the class, and its definition outside the class.
This will get you points.
In the file solution.cpp do the following:
a To get points, add the nonmember function wash as specified in E above.
b To get more points, add the nonmember function print as specified in F above.
c Finally, to get the last points, add the nonmember function bill as specified in G above. using c language
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started