Question: Exercise 1 We must be able to create planetary systems with associated data, we therefore need some classes to represent a planetary system. To begin

Exercise 1

We must be able to create planetary systems with associated data, we therefore need some classes to represent a planetary system. To begin with, we define that a planetary system should be able to have several planets, as well as one star.

Therefore create 3 classes with instance variables:

Planet name, radius, mass Stands name, radius, mass, effectiveTemp PlanetSystem name, centerStar, planets The units in the data set for radius and mass will be explained in more detail in problem 2.4. Select appropriate data types for the instance variables, as well as appropriate constructors for the classes.

Remember to make the instance variables private, and create get and set methods for these (encapsulation).

Exercise 2

Create a class called Main.java that will use the classes you just created.

Create an object of the PlanetSystem class for our own planetary system called "Solar system", with associated Planet objects and one Star object "Sun".

Exercise 3

Implement the toString () method in the classes you created in Exercise 1, create an appropriate printout that provides relevant information about the object.

Use this to print information about the planetary system and some of the planets you have created in Main.java.

Exercise 4

We want to be able to find surface Gravity (g) for a Planet, create a method that calculates and returns this based on the formula:

Image result for surface gravity formula

G = Gravity constant - 6.67408 10-11 m3kg 1s 2 ie approx. number: 0.0000000000667408 M = The mass of the planet (the formula uses kg here) R = Radius of the planet (the formula uses meters here)

Surface gravity on Saturn becomes 11.185248866725233 m / s2.

What will be the surface gravity of Neptune?

Use the method you created to print this in Main.java.

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!