import unittest import inspect ### OOP #2 Inheritance ### The file name should be renamed to your Student ID (00XXXXXXX_hw5.py) ### Each question in section 1 and 2 is worth 25 points. ### Your...

1 answer below ยป
Python


import unittest import inspect ### OOP #2 Inheritance ### The file name should be renamed to your Student ID (00XXXXXXX_hw5.py) ### Each question in section 1 and 2 is worth 25 points. ### Your programs should pass the provided test cases. ### When you want to test your program, uncomment the appropriate test case from bottom, run the program. ### Depending on the test results, modify the code or move to the next question. ### The questions are separate, and the earlier results do not affect your ability to complete other question. ### Do not modify the structure of the code. ### Start of HW4 # Class class Shape: def __init__(self): pass def area(self): return 0 # Q1A # Goal: # Create a child class or a subclass of Shape, called Circle, with an init function which takes radius and pie_value as arguments. # Create a method called get_circumference that calculates and returns the circumference of a circle. # Formula to calculate the circumference of a circle: 2 x pie_value x radius # Input: # None # Output: # Return the class Circle. def q1a(): class Circle(Shape): pass # Your code here! return Circle # Q1B # Goal: # Create a child class or a subclass of Shape, called Square, with an init function which takes a length as an argument. # Override the area method to calculate and return the area of square. # Formula to calculate the area of a square: length x length. # Input: # None # Output: # Return the class Square def q1b(): class Square(Shape): pass # Your code here :) return Square # Q1C # Goal: # Create a child class or a subclass of Shape, called Polygon, with an init function that takes a side_length, number_of_sides, and apothem. # Apothem is the length of a line segment that connects the center of the polygon and the midpoint of a side. # Create a method, called perimeter, to calculate and return the perimeter of the polygon given the number of sides. # Formula to calculate perimeter is side_length x number_of_sides. # Override the area method to reflect the formula for calculating the area of a polygon. # Formula to calculate the area of a regular polygon: (1/2) x apothem x perimeter # Return the class Polygon def q1c(): class Polygon(Shape): pass # Your code here return Polygon # Part 2 Class class Two_dimension(): constructor_called = False def __init__(self, width, length): self.width = width self.length = length self.constructor_called = True # Q2A # Goal: # Create a child class or a subclass of Two_dimension, called Three_dimension, with an init function that takes a width, length, and height. # Create a method, called volume, to calculate and return the volume. # Formula to calculate volume is width x length x height. # Return the class Three_dimension def q2a(): class Three_dimension(Two_dimension): pass # Your code here return Three_dimension # Test # Tells you which test case the program has failed in terminal. # These are examples of test cases provided for you to test your program during the homework. # All test cases should pass. # Uncomment the class when you want to test your program! # class TestQuestion1A(unittest.TestCase): # def test_one(self): # class_received = q1a() # assert '__init__' in dir(class_received), 'Class has no constructor' # assert 'self' in inspect.getfullargspec(class_received.__init__).args, 'self should be an argument for the constructor' # assert 'radius' in inspect.getfullargspec(class_received.__init__).args, 'radius should be an argument for the constructor' # assert 'pie_value' in inspect.getfullargspec(class_received.__init__).args, 'pie_value should be an argument for the constructor' # assert len(inspect.getfullargspec(class_received.__init__).args) == 3, 'the constructor should have exactly three arguments!' # circle_obj = class_received(3, 3.14) # assert 'radius' in dir(circle_obj), 'radius is not a property of the object' # assert 'pie_value' in dir(circle_obj), 'pie_value is not a property of the object' # self.assertEqual(circle_obj.get_circumference(), 18.84) # def test_two(self): # class_received = q1a() # assert '__init__' in dir(class_received), 'Class has no constructor' # assert 'self' in inspect.getfullargspec(class_received.__init__).args, 'self should be an argument for the constructor' # assert 'radius' in inspect.getfullargspec(class_received.__init__).args, 'radius should be an argument for the constructor' # assert 'pie_value' in inspect.getfullargspec(class_received.__init__).args, 'pie_value should be an argument for the constructor' # assert len(inspect.getfullargspec(class_received.__init__).args) == 3, 'the constructor should have exactly three arguments!' # circle_obj = class_received(2, 3.14) # assert 'radius' in dir(circle_obj), 'radius is not a property of the object' # assert 'pie_value' in dir(circle_obj), 'pie_value is not a property of the object' # self.assertEqual(circle_obj.get_circumference(), 12.56) # class TestQuestion1B(unittest.TestCase): # def test_one(self): # class_received = q1b() # assert '__init__' in dir(class_received), 'Class has no constructor' # assert 'self' in inspect.getfullargspec(class_received.__init__).args, 'self should be an argument for the constructor' # assert 'length' in inspect.getfullargspec(class_received.__init__).args, 'length should be an argument for the constructor' # assert len(inspect.getfullargspec(class_received.__init__).args) == 2, 'the constructor should have exactly two arguments!' # square_obj = class_received(5) # assert 'length' in dir(square_obj), 'length is not a property of the object' # self.assertEqual(square_obj.area(), 25) # def test_two(self): # class_received = q1b() # assert '__init__' in dir(class_received), 'Class has no constructor' # assert 'self' in inspect.getfullargspec(class_received.__init__).args, 'self should be an argument for the constructor' # assert 'length' in inspect.getfullargspec(class_received.__init__).args, 'length should be an argument for the constructor' # assert len(inspect.getfullargspec(class_received.__init__).args) == 2, 'the constructor should have exactly two arguments!' # square_obj = class_received(3) # assert 'length' in dir(square_obj), 'length is not a property of the object' # self.assertEqual(square_obj.area(), 9) # class TestQuestion1C(unittest.TestCase): # def test_one(self): # class_received = q1c() # assert '__init__' in dir(class_received), 'Class has no constructor' # assert 'self' in inspect.getfullargspec(class_received.__init__).args, 'self should be an argument for the constructor' # assert 'side_length' in inspect.getfullargspec(class_received.__init__).args, 'side_length should be an argument for the constructor' # assert 'number_of_sides' in inspect.getfullargspec(class_received.__init__).args, 'number_of_sides should be an argument for the constructor' # assert 'apothem' in inspect.getfullargspec(class_received.__init__).args, 'apothem should be an argument for the constructor' # poly_obj = class_received(2, 5, 8) # assert 'side_length' in dir(poly_obj), 'side_length is not a property of the object' # assert 'number_of_sides' in dir(poly_obj), 'number_of_sides is not a property of the object' # assert 'apothem' in dir(poly_obj), 'apothem is not a property of the object' # self.assertEqual(poly_obj.perimeter(), 10) # self.assertEqual(poly_obj.area(), 40) # def test_two(self): # class_received = q1c() # assert '__init__' in dir(class_received), 'Class has no constructor' # assert 'self' in inspect.getfullargspec(class_received.__init__).args, 'self should be an argument for the constructor' # assert 'side_length' in inspect.getfullargspec(class_received.__init__).args, 'side_length should be an argument for the constructor' # assert 'number_of_sides' in inspect.getfullargspec(class_received.__init__).args, 'number_of_sides should be an argument for the constructor' # assert 'apothem' in inspect.getfullargspec(class_received.__init__).args, 'apothem should be an argument for the constructor' # poly_obj = class_received(1, 6, 8) # assert 'side_length' in dir(poly_obj), 'side_length is not a property of the object' # assert 'number_of_sides' in dir(poly_obj), 'number_of_sides is not a property of the object' # assert 'apothem' in dir(poly_obj), 'apothem is not a property of the object' # self.assertEqual(poly_obj.perimeter(), 6) # self.assertEqual(poly_obj.area(), 24) # def test_three(self): # class_received = q1c() #
Answered Same DayJul 02, 2021

Answer To: import unittest import inspect ### OOP #2 Inheritance ### The file name should be renamed to your...

Pritam Kumar answered on Jul 02 2021
150 Votes
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"!{sys.executable} -m pip install pandas\n",
"!{sys.executable} -m pip install numpy\n",
"!{sys.executable} -m pip install matplotlib"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
""
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAEwCAYAAACnqoopAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAFMlJREFUeJzt3X+QZWV95/H3x4HU8MugTOsmjtCYsAaFUdxB2QUxyoqoiWZLtpRSFw21ky2NS3CthITd0iRrLTHRbCzXJbPKDxNFiLIVf4A/iYIUkgw4MvyQlRgCra40w4YfCsrId/+4t7UZhunue+706X7u+1U11fc859x7vk3Tn37uc5/znFQVkqTV73F9FyBJGg8DXZIaYaBLUiMMdElqhIEuSY0w0CWpEQa6JDXCQJekRhjoktSIvZbzZOvWravp6enlPKUkrXrXXnvtXVU1tdBxyxro09PTbNmyZTlPKUmrXpJ/XMxxDrlIUiMMdElqhIEuSY1Y1jH0XXnooYeYmZnhwQcf7LuUZbF27VrWr1/P3nvv3XcpkhrTe6DPzMxwwAEHMD09TZK+y9mjqort27czMzPDoYce2nc5khrT+5DLgw8+yEEHHdR8mAMk4aCDDpqYdyOSllfvgQ5MRJjPmaTvVdLyWhGBLknqrvcx9J1Nn/npsb7ebWe/fMFj1qxZw5FHHsmOHTs4/PDDueCCC9h3330fddzLXvYyPvKRj3DggQeOtUZJGocVF+h92Geffdi6dSsAr33taznnnHN461vf+pP9VUVVcemll/ZVorSqHHnBkX2XsEdtO3Vb3yXskkMuO3n+85/Prbf
eym233cbhhx/Om970Jp7znOdwxx13MD09zV133QXAhz70ITZs2MCznvUsXv/61wMwOzvLq171Ko4++miOPvporrrqqj6/FUkTxh76PDt27OCyyy7jpJNOAuCWW27hvPPO4/3vf/8jjrvxxht55zvfyVVXXcW6deu4++67ATj99NM544wzOO6447j99tt5yUtews0337zs34ekyWSgAw888ADPfvazgUEP/bTTTuM73/kOhxxyCMccc8yjjr/88ss5+eSTWbduHQBPfOITAfjCF77ATTfd9JPj7r33Xu677z4OOOCAZfguJE06A51HjqHPt99+++3y+Kra5fTDhx9+mKuvvpp99tln7DVK0kIcQx/BCSecwMUXX8z27dsBfjLkcuKJJ/K+973vJ8ft6o+EJO0pK66Hvphphn175jOfyVlnncULXvAC1qxZw1FHHcX555/Pe9/7Xt785jezYcMGduzYwfHHH88555zTd7mSJsSKC/Q+3H///Y9qm56e5oYbbnhE22233faTx6eeeiqnnnrqI/avW7eOiy66aI/UKEkLcchFkhphoEtSIxYM9CTnJrkzyQ272Pe2JJVkXZciqqrL01eVSfpeJS2vxfTQzwdO2rkxyVOBFwO3dylg7dq1bN++fSKCbm499LVr1/ZdiqQGLfihaFVdkWR6F7v+FPht4K+7FLB+/XpmZmaYnZ3t8jKrxtwdiyRp3Eaa5ZLkFcC3q+rrXdf33nvvvb17jySNwZIDPcm+wFnAiYs8fhOwCeDggw9e6ukkSYs0yiyXXwAOBb6e5DZgPXBdkn+2q4OranNVbayqjVNTU6NXKknarSX30KtqG/Ckue1hqG+sqrvGWJckaYkWM23xQuBq4OlJZpKctufLkiQt1WJmuZyywP7psVUjSRqZV4pKUiMMdElqhIEuSY0w0CW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4A+qattO7Z8F3pIkAEmOWsRrfS/J4UkeB/ybMdcpdWagq2lVNVNVf7aLXX8I7A1cn+SG4fZCzgQ+xWAxr++Or0ppPLz0X5IaYQ9dkhphoEtSIwx0SWqEgS5JjTDQJakRBrokNcJAl6RGGOiS1Ij/D7K6YeuU7h1hAAAAAElFTkSuQmCC\n",
"text/plain": [
"
"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# Creates a data frame and a bar plot\n",
"df = pd.DataFrame({'Menu':['Burger', 'Sandwich', 'Pizza'], 'Price':[5, 10, 15]})\n",
"df.plot.bar(x = 'Menu', y = 'Price')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
""
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAEmCAYAAAByJWuvAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAFf5JREFUeJzt3X20XXV95/H3hyQ24UEs5OqMxnDxoRblUUOlgw9VKqK2YAdaYdCJlTazlk5LdToWy1q1o2OX1nZm6liLWcqDraDU4sMoqCgqI4O0QVAeIoqaQtRKCEtBhUrkO3+cfcklhOTec07u5vzyfq111z17n33P/uZw74ff+e3fb/9SVUiSJt8efRcgSRoPA12SGmGgS1IjDHRJaoSBLkmNMNAlqREGuiQ1wkCXpEYY6JLUiMULebLly5fX9PT0Qp5Skibe1VdffXtVTe3suAUN9OnpadatW7eQp5SkiZfkn+dynF0uktQIA12SGmGgS1IjFrQPXZLm495772Xjxo3cc889fZeyIJYuXcqKFStYsmTJUD9voEt62Nq4cSP77LMP09PTJOm7nF2qqti8eTMbN27kwAMPHOo17HKR9LB1zz33sP/++zcf5gBJ2H///Uf6NGKgS3pY2x3CfMao/1YDXZIaYR+6pIkxfcYnxvp6G976kp0es2jRIg455BC2bNnCQQcdxHnnnceee+75oONe/OIXc/755/OoRz1qrDXOh4Eu7SKHnHdI3yXMyXWrr+u7hIe1ZcuWce211wJw6qmnctZZZ/G6173u/ueriqri4osv7qvE+9nlIklz9OxnP5ubb76ZDRs2cNBBB/HqV7+apz/96dx6661MT09z++23A/C+972PQw89lMMOO4xXvOIVAGzatIkTTzyRI488kiOPPJIrrrhi7PXZQpekOdiyZQuXXHIJxx13HAA33XQT55xzDu9617secNwNN9zAW97yFq644gqWL1/OHXfcAcDpp5/Oa1/7Wp71rGdxyy238MIXvpD169ePtUYDXZJ24O677+bwww8HBi300047je9+97sccMABHHXUUQ86/rLLLuOkk05i+fLlAOy3334AfOYzn+HGG2+8/7g777yTu+66i3322WdstRrokrQDs/vQZ9trr722e3xVbXf44X333ceVV17JsmXLxl7jDPvQJWmMjjnmGC688EI2b94McH+Xy7HHHss73/nO+4/b3v8kRmULXdLEmMsww7497WlP48wzz+S5z30uixYt4ogjjuDcc8/lHe94B695zWs49NBD2bJlC895znM466yzxnpuA12SduBHP/rRg/ZNT09z/fXXP2Dfhg0b7n+8evVqVq9e/YDnly9fzgc/+MFdUuMMu1wkqREGuiQ1YqeBnuTsJLcluX47z/1hkkqyfNeUJ2l3V1V9l7BgRv23zqWFfi5w3LY7kzweeAFwy0gVSNJDWLp0KZs3b94tQn3mfuhLly4d+jV2elG0qi5PMr2dp/4n8Hrgo0OfXZJ2YMWKFWzcuJFNmzb1XcqCmFmxaFhDjXJJcjzwnar6yu50r2JJC2vJkiVDr96zO5p3oCfZEzgTOHaOx68B1gCsXLlyvqeTJM3RMKNcnggcCHwlyQZgBfDlJP9mewdX1dqqWlVVq6ampoavVJK0Q/NuoVfVdcCjZ7a7UF9VVbePsS5J0jzNZdjiBcCVwFOSbExy2q4vS5I0X3MZ5XLKTp6fHls1kqShOVNUkhphoEtSIwx0SWqEgS5JjT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WuSU3VNVlfdYzbo5y2bqQMTx4ONju/X879aoL7GfOCqEAl1TVZ/utbHJ1Ad5UiM9mCz35GYPJGmHQ8vnJzFPA0qpa0ldtkjQfu32gS1IrdvtRLpLUCgNdkhphoKtJSSrJ387aXpxkU5KP91mXtCsZ6GrVj4GDkyzrtl8AOMxPTTPQ1bJLgJd0j08BLph5IsleSc5O8k9JrunuxkeSV3azhj+Z5BtJ/nzWz/xo1uOTkpy7MP8MaW4MdLXsA8DJSZYChwJXzXruTOCyqjoSeB7w9m5hDoDDgZcBhwAvS/L4BaxZGpoTi9SsqvpqkmkGrfOLt3n6WOD4JH/YbS8FVnaPPzuzOlCSGxmsXnUr0sOcga7WfQz4C+BXgP1n7Q9wYlXdNPvgJM9kcL+PGT9j69/J7Ekbrjurhx27XNS6s4E3VdV12+z/FPB7SQKQZC737Pl+koOS7AH8xpjrlEZmoKtpVbWxqv5qO0+9GVgCfLW7ZfKb5/ByZwAfZ3AvkO+Nr0ppPJz6L0mNsIUuSY0w0CWpEQa6JDXCQJekRhjoktQIA12SGmGgS1IjDHRJasT/B/EeF8AUKdv4AAAAAElFTkSuQmCC\n",
"text/plain": [
"
"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"### YOUR TASK HERE\n",
"# Create a new data frame and a bar plot with different menu items and prices. \n",
"# The new plot should not be the exact same as above. \n",
"\n",
"\n",
"df = pd.DataFrame({'Menu':['Banana', 'Apple', 'Orange','Grapes'], 'Price':[5, 10, 15, 8]})\n",
"df.plot.bar(x = 'Menu', y = 'Price')\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"image/png":...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here