Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This codes should writen in pyhton. There gonna be def inside class. def problem4() inside movie class, def problem5() inside moviecatalog class. In this function,

This codes should writen in pyhton. There gonna be def inside class. def problem4() inside movie class, def problem5() inside moviecatalog class.image text in transcribedimage text in transcribed

In this function, write a class with the following properties and return the class. Your function should not take any parameters. Class properties: - The purpose of the class is to define a movie and get its properties. - Class name should be Movie. - Class should take mandatory and optional parameters. Mandatory ones are movie_name, director, and year, optional parameters are rating and length. - movie_name is a string - director is a string - year is a number between [1920 - 2021] - rating is a float. Should be between [0.0 - 10.0]. Other inputs should be ignored. Default is 0 mins. Default is 0.0 - length is an integer in minutes. Should be between [0 - 500]. Other inputs should be ignored. Default is 0 mins. Class methods: - get_movie_name() that will return the movie name. - get_director() that will return the director name. - get_year() that will return the year that the movie is made. - get_rating() return the movie rating. - get_length() return the movie length. - set_rating (x) set the movie rating. Should be a float and between [0.0 - 10.0]. Other inputs should be ignored. - set_length(x) set the movie length. Should be an integer and between [0 - 500]. Other inputs should be ignored. Problem 5 - Movie Catalog [16 pts] In this function, write a class with the following properties and return the class. Your function should not take any parameters. Class properties: - The purpose of the class is to define a movie catalog using the movie class that we defined in Problem 4. - You can eithel re-implement the Movie class hele, or call problem4() within Problem 5 to access that class. - Class name should be MovieCatalog. - Class should take one parameter called filename, which will point to a txt file with a list of movies. You should parse this file, and create a Movie class instance for each movie and add it to an internal list. (Thus the list should hold a bunch of Movie class instances). 5 INF 211 - Algorithms and Programming I - Electronics Engineering - Gebze Technical University - Fall 2022 Class methods: - add_movie(movie_name, director, year, rating =0.0, length=0) will add the given movie to the list if it is not already in the list. (Do not forget to create a new Movie instance for this movie.) - remove_movie(movie_name) that will remove the movie from the list if it exists. Ignore otherwise. - get_oldest() that will return the name of the oldest movie in the list. - get_lowest_ranking() that will return the name of the lowest ranking movie in the list. - get_highest_ranking() that will return the name of the highest ranking movie in the list. - get_by_director(director) that will return a list of movies that are made by given director. If the director has no movies in the movie list, return an empty list. Example Doctests: ['The Godfather', 'The Godfather: Part II']

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions

Question

How were the HR functions affected by Hurricane Rita?

Answered: 1 week ago