CS 200 – Introduction to Programming
Assignment 3, Fall 2021
Due Date: Sunday 12 December 2021, 11:55pm
Please keep in mind the following guidelines:
• Do not share your program code with anyone.
• Do not copy code from the internet.
• If you receive any assistance, mention the part of the code in which you received
assistance.
• You must be able to explain any part of your submitted code.
• Properly comment on your code, so that it’s easy to be evaluated.
• All submissions are subject to automated plagiarism detection.
• You have to submit all the .cpp files containing the source code. Zip all .cpp files into one
file named <rollnumber>_Assignment3_CS200.zip and submit the zip file.
o For example: 23100075_Assignment3_CS200.zip
• Submission Policy:
o 1 day late = 10% deduction
o 2 days late = 15% deduction
o No assignments will be accepted 2 days after the deadline
• For problems and issues, you must join Piazza link mentioned on LMS so that your
queries will be answered there quicker instead of by email.
Video Store:
For a family or individual, a favorite place to go on the weekend or holiday is to a video store to
rent movies’ cassettes. A new video store in your neighborhood is about to open. However, it
does not have a software to run the rental operations yet. For this we need to create a system
that manage all the rental operations along with customer and video details.
Video Store component: 50 Marks
For this problem we need to create three different classes VideoStore, CustomerInfo and
VideoInfo and two node structure named Customer and Video which utilize classes CustomerInfo
and VideoInfo respectively to create node that we can use in our lists.
The class VideoStore has two data member revenue and outstandingAmount. Class VideoStore
use the two node structure named Customer and Video to populate the lists. VideoStore
performs the following operations:
1. Rent a video: This operation rent a video to the customer. It includes the ID and
name of the customer, name of the video, renting date and time (check out date
and time), and due date and time of return (check in date and time). The due date
is one week from the renting date and time. This operation should also include
record of the rent being paid. The rent for a single video has to be paid at the time
of renting. The rent of a single video is Rs. 1000. It checks the number of copies
available in stock, if copies are greater than zero then rent out the video cassette.
2. Return a video: This operation return a video to the store. It looks at the check in
date and time. If the return is within time then no fine is imposed otherwise a fine
of Rs. 50 per hour is imposed. Also increment the available copies of that video.
3. Total videos at store: This operation display the list of all movies in the video store,
print titles in alphabetically ascending order.
4. Total checked out video record: This operation display the list of all rented movies
(video cassettes that are currently on rent) with titles, check out date & time and
expected check in date & time. Arrange the list with expected check in time
(ascending order).
5. Total checked in video record: This operation display the list of all movies (video
cassettes) that are available in store. If a movie that has 3 copies; and 2 copies out
of 3 are on rent the system will display that movie name in both lists i.e., total
checked out video record and total checked in video record.
6. To search and print the list of movies of a particular
a. Protagonist
b. Director
Display the list of movies’ titles in alphabetically ascending order.
7. Total revenue generated: The amount collected at the time of renting and
returning the video is the revenue generated. The sum of total amount received
on a date, is the revenue generated on that date (e.g., on 21st Dec 2020, we rented
out 5 movies and collected 500Rs. as fine of some other movie(s) so total revenue
will be 1000*5 + 500 = 5500 for that day). This operation display the revenue
generated report. It takes starting and ending date from the user and calculate
the revenue generated during the specified period.
8. Total outstanding amount: This operation calculate the fine of all overdue videos.
A video is an overdue video date if it not returns to the video store within in due
date and time. It calculates the outstanding amount of all those video. Sum the
amount of all overdue videos and display it.
9. Print list of videos rented by a particular customer: This operation display the list
of videos rented by a particular customer along with due date of return. Display
the list in ascending order of due date & time.
10. Add new video: This operation adds a new video in the store (add a new node in
the linked list). The user enters the title, protagonist, director and total number of
copies.
11. Add new customer: This operation adds a new customer in the store (add a new
node in the linked list). The user enters the first name and last name of the
customer. This operation sets the account status clear and amount due 0. It also
generate a number (randomly but make sure that, this number has not assigned
before as customer ID). Assign this number as customer ID to newly created
customer.
The video store has two major components: videos and customers. We will describe those two
components in detail. To handle them we need to maintain two lists.
1. A list of all the videos in the store.
2. A list of all the customers in the store.
PART 1: VIDEO COMPONENT 20 Marks
VIDEO OBJECT: The common things associated with a video are:
1. Name of the movie
2. Name of the protagonist
3. Name of the director
4. Total number of copies
5. Number of available copies
Video List: We need to maintain a list of all the videos in the store (this list will be in VideoStore
class), and we should be able to add a new video to our list. In general, we would not know how
many videos are in the store and adding or deleting a video from the store would change the
number of videos in the store. Therefore, we will use a linked list to create a list of videos.
The primary operations on the video list are to check in a video and to check out a video. Both
operations require the list to be searched and the location of the video being checked in or
checked out to be found in the video list. Other operations such as determining whether a
particular video is in the store, updating the number of copies of video, and so on, also required
the list to be searched. To simplify the search process, we will write a function named:
searchVideoList that searches the video. If the video is found, its sets a parameter found to true
and returns a pointer to the video so that the check-in, check-out and other operations on the
video object can be performed.
We will create a class named VideoInfo, which will have five members: VideoTitle, protagonist,
movieDirector, availableCopies, and totalCopies. Then we will create a node structure named
Video which will act as a node in our Linked List implementation. This node structure will contain
an object of class VideoInfo and a next pointer, just like a node in linked list.
List of operations to be performed on the video object are:
1. Set the video information: it sets the movie title, protagonist, director, available
Copies, and total number of Copies.
2. Video Detail: It display the details of a particular movie search by the user with title.
The display details includes: movie title, protagonist, director, available Copies, and
total number of Copies.
3. Check whether a particular video is available: User searches the availability of a
particular movie by title. It checks whether a particular movie exist in the store and
the number of available copies is greater than zero. It display “Yes movie available to
rent out”. If the movie exists in the store but available copies is zero then display the
expected date and time of check in (of all copies, arrange in ascending order on
returning time). Otherwise display that movie not available on the store.
4. Number of copies: It checks the total number of copies and available copies of a
particular movie in the store (search by the user with title). It display total number of
copies and available copies of that movie.
5. Delete video cassette: The deletion of a video cassette decrement the total number
of copies. If total number of copies is zero simply delete that node from the list. You
need to check the title of a video to find out which video is to be deleted from the list.
Part 2: Customer Component 10 Marks
Customer Object: The customer object stores information about a customer. Create a list of
customers named: “CustomersList” (again this list will be in VideoStore class). As before we will
create a node structure named Customer which will hold an object of class CustomerInfo and a
next pointer. The class CustomerInfo will have following attributes:
1. The customer’s first name
2. The customer’s last name
3. The customer’s ID (Generated randomly)
4. The customer’s account status
5. The customer’s amount due
6. The list of rented videos
The basic operations on an object of the Customer are:
1. Display Customer Info: This operation print the customer information that is customer
name, ID, account status, due amount and the list of rented videos.
2. Set the Customer Info: It sets the customer information, like its name, ID, account
status, due amount, and the list of rented videos.
Main Program & Driver code 20 Marks
Main Program:
This function informs the user what to do. It contains the following menu of video store:
Select one of the following:
1. Add new video
2. Add new customer
3. Show the details of a particular video
4. To check whether the store carries a particular video
5. Rent a video
6. Return a video
7. Total videos at store
8. Total checked out video record
9. Total checked in video record
10. To search and print the list of movies of a particular
a. protagonist
b. director
11. Total revenue generated
12. Total outstanding amount
13. Delete video cassette
14. Print videos rented by a particular customer
15. To exit
Driver code:
Write a driver program that input the data of 5 movies and 5 customers to test the functionality
of video store program.
Instructions:
1. For date and time, you may use any pre implemented class or you can handle it via string
yourself. Specify the date and time format as per your convenience. But make sure that
it is same throughout your project.
2. Input should be given in upper case. Handle the input if it is in lower case; just convert
into upper case.
3. There are three classes named: VideoStore, CustomerInfo and VideoInfo, and two node
structure named Customer and Video which utilize classes CustomerInfo and VideoInfo
respectively to create node that we can use in our lists. We will only create object of
VideoStore in our driver/Main program and all operations are to be done using that
object. So, we will have to write functions in VideoStore class.
4. We have deliberately not mentioned the placement of some functions and a few function
names. This is also part of your assignment to understand where things should be placed.
Sample Input/output:
Main Menu
Add new video
Add new customer
Show the details of a particular video
To check whether the store carries a particular video
Rent a video
Return a video
Total videos at store
Total checked out video record
Total checked in video record
To search and print the list of movies of a particular
Total revenue generated
Total outstanding amount
Delete video cassette
Print videos rented by a particular customer