Question: PROBLEM Introduction Write a program that simulates a customer service line at an Apple store. The line is a linked - list of pointers. Customers
PROBLEM
Introduction
Write a program that simulates a customer service line at an Apple store. The line is a linkedlist of
pointers. Customers arrive at time specified by monthdayyear plus hourminute The customers
are served on a first come first serve basis. Here is the rest of the specification.
Your solution
Write a C program that has the following and does the following:
Page of
Write a class that will represent the template of a node in the linked list. The classs definition
in a h or hpp file and implementation in a cpp file must be in separate files. The members of
the class should be:
a sequenceNumber: type unsigned int
b name: type string
c month: integer
d day: integer
e year: integer
f hour: integer
g minute: integer
h serviceRequired: type string
i next: pointer to a node
Write a class whose data members are:
i a head pointer to a node The head will represent the start of a linked list
ii a pointer to the last node.
iii DO NOT USE C STL containers list queue, stack,
The classs definition in a h or hpp file and implementation in a cpp file must be in separate
files.
The member functions are specified below define functions outside class
b Constuctor: initialize all class instance variables.
c insertNode: When a customer has just arrived, allocate memory for a new node using the
class and assign details received in parameters to the new node. The first node will be
given sequence number and subsequent nodes will have sequence numbers in increments
of Make the new node the first node in the list. The month, day, year, hour, and minute
should be set to the current time and sequenceNumber is assigned. The parameters should
be serviceRequired and name. Once a Node is given a sequenceNumber it should never be
changed, and no squenceNumber should be used more than once.
d deleteNode: A customer may leave before being served. This method should receive the
name of the customer name as a parameter Delete the node by putting its next pointer into
the previous node next pointer. It should return true if the customer was found and deleted
else false if the customer was not found.
e searchNode: This function receives the customer name as a parameter. Recursively process
the list to find the customer. Return a pointer to a copy of the current node when found or
null when end of list is reached.
f serveCustomer: Delete the customer at the tailend of the list. Display a message saying
the customer has been served.
g listAll: recursively go through the linked list from beginning to end displaying line:
Page of
N Customername MMDDYYYY HH:MM XXXXXXX
where N is the sequence number, Customername is the name of the customer,
MMDDYYY is the date from the date members of the class, HH:MM is the time from the
time data members, and XXXXXX is the purpose of the visit from the service required data
member.
Return the number of nodes in the linked list.
h Destructor: delete all the nodes.
The main function: Write a main function that instantiates an object using the linked list
class. The main function must be in a separate file from the classes above. The main function
should have a do while loop that runs until quit is selected and offers the user the
following menu:
New customer arrival
Serve customer
Customer left remove from waiting list
List all customers waiting for service
Quit
Next in the loop, an option made by the user should be input. Depending on the option selected
by the user, one of the operations listed in the bulleted list below should be performed. You
may use a switch statement to handle this selection.
New customer arrival: The user inputs the name, service request. Then insertNode is called
with named and service request as parameters. The member function of the class creates and
inserts a node while setting the date time fields to the current date and time and the sequence
number to its correct value.
Serve customer: when this option is selected, call the serveCustomer member function of the
class.
Customer left: when this option is selected, input the name of the customer who left. This
should be passed to the deleteNode function of the class and the node should be deleted when
found. The function should return the status of the delete. If the customer was found, display a
message stating that the customer was not served and is removed otherwise state that the
customer was probably already served anyway.
List all: First display the following table headings:
APPLE CUSTOMER SERVICE WAITING LIST
SEQUENCE NAME ARRIVAL DATETIME PURPOSE OF VISIT
Page of
Next, call the listAll member function of the object putting it on the right of an assignment to
an integer to receive the returned number of nodes in the list.
Display a message:
Display a message:
There are NN customers waiting to be served.
Where NN is an integer.
Test Cases
The following test cases are the minimal that will be executed
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
