{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### ![](https://ga-dash.s3.amazonaws.com/production/assets/logo-9f88ae6c9c3871690e33280fcf557f33.png)\n",
    "\n",
    "# Unit 3 Lab: Object-Oriented Programming\n",
    "\n",
    "## Overview\n",
    "Welcome to the Unit 3 lab!\n",
    "\n",
    "We're making a slight jump with this lab to OOP structure, so please use the starter notebook as a starting point.\n",
    "\n",
    "Let's use object-oriented programming concepts to improve our code. Specifically, we'll be using dictionaries and classes."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Media Class\n",
    "\n",
    "Create a `Media` class. This will be the parent class of `Movie`, and it itself will inherit from the `object` base python class.\n",
    "\n",
    "- The `Media` class will take two arguments, `publisher` and `market`, both of which are strings. These strings will set class instance variables, `self.publisher` and `self.market`. Whenever this class is instantiated or called, assume values of `Universal Studios` for `publisher` and `USA` for `market`.\n",
    "- The `Media` class will have one class method, `get_media_info()`. This method will print the `self.publisher` and `self.market` class instance variables to stdout and return `None`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "# A:"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Movie Class\n",
    "\n",
    "Create a `Movie` class. This class will <i>inherit</i> from the base `Media` class. We're going to have several movies, each of which will have a title and a rating. We can use a `Movie` class as a scaffold to create many movie objects. Your `Movie` class should have three methods:\n",
    "   1. `__init__`, which will take in `self`, `movie_data` (this will be a dictionary containing the title and rating of each movie), `publisher` and `market`. `__init__` will set a member variable, `movie_data`, to equal the `movie_data` dictionary passed in. `publisher` and `market` variables will be passed to the parent `Media` object, which must also have its `__init__()` method called using the `super()` builtin function.\n",
    "   1. `get_movie_title()`, a getter function that returns the value of the `title` key in the `movie_data` dictionary.\n",
    "   1. `get_movie_rating()`, a getter function that returns the value of the `rating` key in the `movie_data` dictionary."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# A:"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Return Single Movie Object\n",
    "\n",
    "Now that we have a class, let's make a function that creates `Movie` objects.\n",
    " - Create a function called `return_single_movie_object()` that takes four arguments:\n",
    "   - `movie_title`\n",
    "   - `movie_rating`\n",
    "   - `publisher`\n",
    "   - `market`\n",
    " - Have it create and return a `Movie` object with those values."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# A:"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Print All Ratings\n",
    "Let's make a function, `print_all_ratings` that takes a list of movie titles, iterates through them, and prints a result to stdout (more on that below).\n",
    "\n",
    "- The `print_all_ratings` function will call the `return_single_object` function on each iteration to return a `Movie` object.\n",
    "- Use the following hard-coded values of the following parameters when calling `return_single_object`:\n",
    "\n",
    "<table>\n",
    "    <tr>\n",
    "        <td>Variable</td>\n",
    "        <td>Value</td>\n",
    "    </tr>\n",
    "    <tr>\n",
    "      <td>movie_rating</td>\n",
    "      <td>4</td>\n",
    "    </tr>\n",
    "    <tr>\n",
    "      <td>publisher</td>\n",
    "      <td>\"Universal Studios\"</td>\n",
    "    </tr>\n",
    "    <tr>\n",
    "      <td>market</td>\n",
    "      <td>\"USA\"</td>\n",
    "    </tr>    \n",
    "</table>\n",
    "\n",
    "- After returning a `Movie` object, use the `get_movie_title` and `get_movie_ratings` class methods to retrieve the title and ratings of the Movie, respectively.\n",
    "- The printed result to stdout will be of the format: `The movie <movie title> has a rating of <movie rating>`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "# A:"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
