this is what I got…

Question Answered step-by-step this is what I got… Image transcription text18.5 Celestial Bodies This lab will be available untilJune ‘1 6th, 11:59 PM MST A simulation ofthe solarsystem would contain many different ce… Show more… Show moreImage transcription textThe class Moon should be derived from CelestialBody. Itshould be initialized with name, position, mass, radius, andthe new argument parent. parent should be t… Show more… Show morethis is what I got ————————————————————————import numpy as npimport mathif __name__ == “__main__”:# objects created hereclass CelestialBody:def __init__(self,name,position,mass,radius):self.name=name;self.position=positionself.mass=massself.radius=radiusdef distance(self,other):dist = np.subtract(other.position,self.position)return math.sqrt(np.dot(dist,dist))def volume(self):return (4 / 3)*math.pi * (self.radius) * self.radius * self.radiusdef density(self):vol=self.volume() return self.mass/vol def delta_r(self,other):return np.subtract(other.position,self.position)class Planet(CelestialBody):passclass Moon(CelestialBody):def __init__(self,name,position,mass,radius,parent):CelestialBody.__init__(self,name,position,mass,radius)self.parent=parentearth = Planet(“Earth”,np.array([9.978977040419635E-01, 6.586825681892025E-02, -6.320430920521123E-06]),5.97219e24,6371.01)luna = Moon(“Luna”,np.array([9.956768547953816E-01, 6.676030485840675E-02, 1.641093070596718E-04]),7.349e22,1737.53,earth)mars=Planet(“Mars”,np.array([-1.638989837611019E+00,2.909235766064876E-01,4.607875056151672E-02]),6.4171e23,3389.92)deimos=Moon(“Deimos”,np.array([-1.638943766241257E+00,2.907775944863155E-01,4.604465570526414E-02]),1.80e20,2.9,mars)phobos=Moon(“Phobos”,np.array([-1.638995094538730E+00,2.909862261134459E-01,4.608601582090829E-02]),1.08e20,2.4,mars)# testingprint(luna.name)print(luna.distance(luna.parent))print(earth.delta_r(mars))print(phobos.density())print(deimos.density()) —————————————————————————————- I need to fix my code to obtain this points1: Unit test: earth (simple)0 / 12: Unit test: luna (simple)0 / 19: Unit test: CelestialBody (simple)0 / 1210: Unit test: CelestialBody (advanced)0 / 6 Computer Science Engineering & Technology Python Programming PHY 3106 Share QuestionEmailCopy link Comments (0)

Leave a Comment

Your email address will not be published. Required fields are marked *