Question: Question 4: Let's define a subclass for the Vector class that appeared in the Lab Worksheet this week (if you don't remember it, go back

Question 4: Let's define a subclass for the Vector class that appeared in the Lab Worksheet this week (if you don't remember it, go back and read it). The subclass we want to define is the UnitVector subclass. In mathematics, a unit vector is a vector of length 1, and therefore can be uniquely defined by its angle (which we'll assume is in radians). Thus, the initialization method for UnitVector should take a single input (along with self) called angle and should call the Vector class' initialization method to create a vector with a = cos(angle) and b= sin(angle) To make sure this last question doesn't take too much time, I will make it a fill-in-the-blank style problem. Copy and paste what you see below and fill in the blanks (i.e., the question marks). I'm importing the math module so we can use the sin and cos functions (feel free to google the math module). import math class Unit Vector (?????): def __init__(self, ???): a ???? b - ???? super(). __init__(?, ??)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
