curriculum/challenges/english/blocks/learn-encapsulation-by-building-a-projectile-trajectory-calculator/65fd4b3bedee044b4b957d33.md
Create a Projectile class with an __init__ method that initializes the class using three arguments: the starting speed, the starting height, and the starting angle of the throw of the projectile, in this order.
Inside the __init__ method, assign these arguments to three private attributes: __speed, __height, and __angle. The angle provided will be in degrees; however, it should be stored internally in radians. To achieve this, use the math.radians() function to convert the angle from degrees to radians when assigning it to __angle.
The use of two underscores before an attribute name triggers name mangling in Python. This means the attributes are not directly accessible from outside the class using their given names, and must be accessed with the mangled names like ball._Projectile__height if needed externally, indicating these are intended for internal use only.
You should use class Projectile: to create the class.
({test: () => assert(runPython(`_Node(_code).has_class("Projectile")`))})
You should have an __init__ method inside the Projectile class.
({test: () => assert(runPython(`_Node(_code).find_class("Projectile").find_body().has_function("__init__")`))})
A new Projectile class instance should have the values of the three attributes properly initialized.
({test: () => assert(runPython(`
import math
GRAVITATIONAL_ACCELERATION = 9.81
PROJECTILE = "∙"
x_axis_tick = "T"
y_axis_tick = "⊣"
p = Projectile(20, 21, 22)
p._Projectile__height == 21 and p._Projectile__speed == 20 and p._Projectile__angle == math.radians(22)
`))})
import math
GRAVITATIONAL_ACCELERATION = 9.81
PROJECTILE = "∙"
x_axis_tick = "T"
y_axis_tick = "⊣"
--fcc-editable-region--
--fcc-editable-region--