Question: FreeBodyObjects.py 1 #Aecall in coding Problem 4.4.4 (and before that, in coding 2 Problem 4.3.9) you built a program for finding the net 3#force (magnitude

 FreeBodyObjects.py 1 #Aecall in coding Problem 4.4.4 (and before that, in
coding 2 Problem 4.3.9) you built a program for finding the net

FreeBodyObjects.py 1 #Aecall in coding Problem 4.4.4 (and before that, in coding 2 Problem 4.3.9) you built a program for finding the net 3#force (magnitude and angle) on an object from several 4#individual forces. 6 In the next two exercises, we're going to convert that 71#3ystem into one that uses objects. 9#To start, create a class called Force. The constructor for 10 Force should have two required arguments: magnitude and 11#angle. These should be saved to two attributes called 12 #"magnitude' and 'angle'. You should assume angle is 13 #initially in degrees, from -180 to 180. 15 #Then, add three methods to Force: 17 #-get-horizontal should return the horizontal component 18 # of the force, according to the formula: 19 # horizontal-magnitude * cos (angle). 20 #-get vertical should return the vertical component of 21 the force, according to the formula: 22 # vertical magnitude * sin(angle). 23 #-get-angle should return the angle of the force, but 24 # should have a keyword parameter called use-degrees. 25 use-degrees should default to True. If use-degrees 26 is true, it should return the angle in degrees; if it 27 # is false, it should return the angle in radians. 29 #HINT: Don't overcomplicate this. All we want here is 30 a class called Force with four methods init 31 #get horizontal, get vertical, and get angle. Note that 32 #these are not true "getters" even though they have "get" 33 Win their names: all three will have some reasoning #beyond just returning a single value 36 #HINT 2: angle will initially be passed into the 37 constructor in degrtnes. You may atore it in either 38 degrees or radians. Each approach has different benefits, 39 fbut make sure?o keep track of when it's dnnngles and 40 wwhen it's in degreea

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!