Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You will write a program that will perform the basic tasks of a Red Box movie an

ID: 3824560 • Letter: Y

Question

You will write a program that will perform the basic tasks of a Red Box movie and video game rental. This program should simulate a user approaching the machine and making a rental transaction. The program should be able to perform at least these tasks: Show all movies that are carried in the machine Show only movies or games currently available to rent Rent a movie or game Return a movie or game Show all movies with a specific genre (e g. comedy, action, etc) and/or from a given year to the current year. Things that can be assumed: After a movie game has been confirmed that it can be rented, it is immediately paid for and can be marked as unavailable Everyone renting is old enough to rent movies or games of any level rating (rated G to R; rated E to A) Only one person will be renting or returning at a time. (every time the program is executed will represent a new person coming to rent or return) All movies and games will have at least a name, genre, year released and rating. Some movies and or games will be unavailable when a person comes to the machine

Explanation / Answer

#reading the details of films and displaying
a=open("list.txt","a+")
b=a.readlines()
movies=[]
for line in b:
sline = line.split(" ")
movies.append(sline)
l=""
for i in sline:
l+=i+" "
print(l)
#asking the user for input
print(" Please Select the option: 1.Rent a movie 2.Return a movie.")
inp = int(input("Enter the option 1 or 2:"))
#checking the input for renting the movie
if(inp==1):
sno = int(input(" Enter the S.No of the movie to Rent:"))
if(movies[sno][5][:-1]=="Unavailable"):
print(" The movie that you are asking is Unavailable.")
else:
print(" Thank you for choosing %s."%movies[sno][1])
movies[sno][5]="Unavailable "
#checking the option for returning
elif(inp==2):
sno = int(input(" Enter the S.No of the movie to Return:"))
print(" Thank you for returning %s."%movies[sno][1])
movies[sno][5]="Available "
else:
print("No such option is found.")
  
print(" ")   
#updating the file
aa=open("list.txt","w+")
for i in range(len(movies)):
line=" ".join(movies[i])
aa.write(line)
print(line)

aa.close()
a.close()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote