Assignment 2
Assignment 2
SEMESTER – II
BCA1211C08 : Object Oriented Programming Date : 13/01/2023
1. Create a Country class with data members name and population and define setter and
getter methods for defining them.
2. Create a Product class with data members prod_name and price , along with a
parameterized constructor of prod_name and price, also create a list of products by
taking input from the user.
3. Create a Movie class as under and note the output
class Movie:
def __init__(self,a,b,c):
self.title=a
self.hero=b
self.heroine=c
def info(self):
print(‘Movie name:’,self.title)
print(‘Hero name:’,self.hero)
print(‘Heroine name:’,self.heroine)
list_of_movies=[]
while True:
title=input(‘Enter movie name:’)
hero=input(‘Enter hero name:’)
heroine=input(‘Enter heroine name:’)
m=Movie(title,hero,heroine)
list_of_movies.append(m)
print(‘Movie added successfully’)
option=input(‘Do you want to add one more movie[Yes/No]:’)
if option.lower()==’no’:
break
print(‘All movies information:’)
for movie in list_of_movies:
movie.info()
print()
class Test:
def __init__(self):
self.a=10
self.b=20
self.c=30
self.d=40