title         self.director = director         self.producer = producer         self.release_date = release_date         self.duration = duration         self.dvd_id = dvd_id     def get_title(self):         return self.title     def get_director(self):         return self.director     def get_producer(self):         return self.producer

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

class dvd:
    def __init__(self, title, director, producer, release_date, duration, dvd_id):
        self.title = title
        self.director = director
        self.producer = producer
        self.release_date = release_date
        self.duration = duration
        self.dvd_id = dvd_id
    def get_title(self):
        return self.title
    def get_director(self):
        return self.director
    def get_producer(self):
        return self.producer
    def get_release_date(self):
        return self.release_date
    def get_duration(self):
        return self.duration
    def get_dvd_id(self):
        return self.dvd_id
    def __repr__(self):
        return "Movie Name: "+self.title+", \nDirector : "+self.director+", \nProducer : "+self.producer+", \nRelease Date : "+str(self.release_date)+", \nDuration : "+str(self.duration)+", \nDVD ID : "+str(self.dvd_id)
 

 

class customer:
    def __init__(self, name, customer_id):
        self.name = name
        self.dvds=[]
        self.customer_id = customer_id
    def get_name(self):
        return self.name
    def get_customer_id(self):
        return self.customer_id
    def getDvds(self):
        s=""
        for d in self.dvds:
            s=s+d.__repr__()+"\n"
        return s
       
    def __repr__(self):        
        return "Customer Name : "+self.name+"\nCustomer ID : "+str(self.customer_id)+"\n Rented DVD Details : "+self.getDvds()
 

 

class store:
    def __init__(self):
        self.dvds = []
        self.customers = []
    def add_dvd(self, dvd):
        self.dvds.append(dvd)
    def add_customer(self, customer):
        self.customers.append(customer)
    def rent_dvd(self, dvd_id, customer_id):
       for dvd in self.dvds:
           if dvd.get_dvd_id() == dvd_id:
               for customer in self.customers:
                   if customer.get_customer_id() == customer_id:
                       customer.dvds.append(dvd)
                       self.dvds.remove(dvd)
    def return_dvd(self, dvd_id, customer_id):
        for customer in self.customers:
            if customer.get_customer_id() == customer_id:
                for dvd in customer.dvds:
                    if dvd.get_dvd_id() == dvd_id:
                        self.dvds.append(dvd)
                        customer.dvds.remove(dvd)

    def get_dvd(self, dvd_id):
        for dvd in self.dvds:
            if dvd.get_dvd_id() == dvd_id:
                return dvd
    def get_customer(self, customer_id):
        for customer in self.customers:
            if customer.get_customer_id() == customer_id:
                return customer
    def get_dvds(self):
         return self.dvds
    def get_customers(self):
       return self.customers
    def get_dvds_for_customer(self, customer_id):
        for customer in self.customers:
            if customer.get_customer_id() == customer_id:
                return customer.dvds

     

 

# main
store = store()


dvd1 = dvd("Iron Man", "Jon Favreau", "Avi Arad/Kevin Feige", 2008, 156, 1)

dvd2 = dvd("The Incredible Hulk", "Louis Leterrier", "Avi Arad/Gale Anne Hurd/Kevin Feige", 2008, 91, 2)

dvd3 = dvd("Iron Man 2", "Jon Favreau", "Kevin Feige", 2010,  150, 3)

dvd4 = dvd("Thor", "Kenneth Branagh", "Kevin Feige", 2011, 144, 4)

dvd5 = dvd("Captain America: The First Avenger", "Joe Johnston", "Kevin Feige", 2011, 144, 5)

dvd6 = dvd("The Avengers", "Joss Whedon", "Kevin Feige", 2012, 133, 6)

dvd7 = dvd("Iron Man 3", "Shane Black", "Kevin Feige", 2013, 126, 7)

dvd8 = dvd("Thor: The Dark World ", "Kenneth Branagh", "Kevin Feige", 2013, 114, 8)

dvd9 = dvd("Guardians of the Galaxy", "James Gunn", "Kevin Feige", 2014, 120, 9)

dvd10 = dvd("Avengers: Age of Ultron", "Joss Whedon", "Kevin Feige", 2015, 132, 10)


 

store.add_dvd(dvd1)

store.add_dvd(dvd2)

store.add_dvd(dvd3)

store.add_dvd(dvd4)

store.add_dvd(dvd5)

store.add_dvd(dvd6)

store.add_dvd(dvd7)

store.add_dvd(dvd8)

store.add_dvd(dvd9)

store.add_dvd(dvd10)

 

 

customer1 = customer("Willim Harvay", 1)

customer2 = customer("Robort Root", 2)

customer3 = customer("Romina Daniel", 3)

customer4 = customer("Ravi Chaudri", 4)

customer5 = customer("Elsa Gorgeo", 5)
 
customer6 = customer("John Trimander", 6)

customer7 = customer("Srabell Carnico", 7)

customer8 = customer("Mike samson", 8)

customer9 = customer("Shorlok Williamson", 9)

customer10 = customer("Rocky simon", 10)

 

 

store.add_customer(customer1)

store.add_customer(customer2)

store.add_customer(customer3)

store.add_customer(customer4)

store.add_customer(customer5)

store.add_customer(customer6)

store.add_customer(customer7)

store.add_customer(customer8)

store.add_customer(customer9)

store.add_customer(customer10)

 

store.rent_dvd(1, 1)

store.rent_dvd(2, 1)

store.rent_dvd(3, 2)

store.rent_dvd(3, 3)

store.return_dvd(2, 1)


store.rent_dvd(1, 1)

store.rent_dvd(2, 1)

store.rent_dvd(3, 2)

store.rent_dvd(3, 3)

store.return_dvd(2, 1)

 

Create the management method for the following classes,

a)Admin mode:

  • See the Available List of DVD
  • See the rent-out DVD list
  • Add DVD
  • Add Customer
  • Remove DVD
  • Remove Customer

b)Customer mode:

  • See the Available List of DVD
  • Rent a DVD
  • Return a DVD
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Concept of pointer parameter
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY