Hello I've been working in the code and I need to modify the code below
My concern are the following:
- [6]Check Video Availability = when you input 6 in the system and enter the movie code, it will show the movie details that inputted by the user in the insert a video and check if the movie is available or not. If the copy of the movie inputted by the user reaches 0 (due to renting the movie which decreases the copies of the movie) it will state that the movie is unavailable.
- I also need to implement this:
[7] Customer Maintenance - If the user inputs 7 it will show another options:
[1] - Add Customer
[2] - Show Customer Details
[3] - List of Videos Rented by a Customer
* I must store the customers in a queue when I retrieved them from the text file
Rented videos will be stored in a stack and will be saved in the CUSTOMER-RENT text file when
the user chooses [8] Exit Program.
hello. I've updated my concern sorry for inconvenience. my concern is to help me modify the code based on the following:
- [6]Check Video Availability = when you input 6 in the system and enter the movie code, it will show the movie details that inputted by the user in the insert a video and check if the movie is available or not. If the copy of the movie inputted by the user reaches 0 (due to renting the movie which decreases the copies of the movie) it will state that the movie is unavailable.
- I also need to implement this:
[7] Customer Maintenance - If the user inputs 7 it will show another options:
[1] - Add Customer
[2] - Show Customer Details
[3] - List of Videos Rented by a Customer
On line 150, you're missing, what I assume, should be this:
while(nodePtr != NULL)
The bigger issue is that renting a movie deletes the node while returning it creates a new node again. This is NOT how you want to do it.
You ask the user for the number of copies of the movie you have. When you rent a movie, you don't delete the node, you subtract 1 from the variable "copies". If copies is already 0, then you tell them you can't rent it because it's unavailable.
When they return the movie, you increase "copies" by 1.
So when they enter the code, search for the node as you already are, but don't delete it!
I must store the customers in a queue when I retrieved them from the text file
Rented videos will be stored in a stack
There seems to be some confusion over this. CinemaList seems to be a single forward linked list. But this is not a stack/queue. For a stack, items are pushed onto the top of the stack when added and removed from the top of the stack (LIFO). For a queue, items are pushed onto the top of the queue and removed from the bottom of the queue (FIFO). For either, you don't amend an already added item and you don't remove an item other than at the top for stack or bottom for queue. Usually you don't iterate over a stack/queue either. You just know about the top (for stack) or bottom (for queue) element.
Now if you are required to use a stack/queue as opposed to lists and if you are required to implement your own stack/queue from scratch (as opposed to using the C++ std::stack and std::queue containers), then first I would suggest to actually implement a class for a stack and a class for a queue based upon a double linked (with head/tail pointers) list class. Once you have a working stack/queue then you can code the requirements for the program around these.