Tests: In the test_sun.py module, create tests for the planet objects. You can (and should) do this before you have written any Planet code at all. Implementation: In the sun.py module (see template), implement a Sun class as described in Section 10.4. Your Sun class should include the following methods: __init__, get_mass, get_radius, get_temperature, and __str__. Your __str__ method should include the following information for each planet: Name, distance from sun, radius, and mass.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 10PE
icon
Related questions
Question

Tests: In the test_sun.py module, create tests for the planet objects. You can (and should) do this before you have written any Planet code at all.

Implementation: In the sun.py module (see template), implement a Sun class as described in Section 10.4. Your Sun class should include the following methods: __init__, get_mass, get_radius, get_temperature, and __str__. Your __str__ method should include the following information for each planet: Name, distance from sun, radius, and mass.

section 10.4

class Solar System:
def _init_(self, aSun):
self._theSun = aSun
self._planets = []
def addPlanet(self,aPlanet):
self._planets.append (aPlanet)
def showPlanets (self):
for aPlanet in self._planets:
print(aPlanet)
Transcribed Image Text:class Solar System: def _init_(self, aSun): self._theSun = aSun self._planets = [] def addPlanet(self,aPlanet): self._planets.append (aPlanet) def showPlanets (self): for aPlanet in self._planets: print(aPlanet)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,