Menu

Q4 Write Class Named Planet Contains Two Instance Variables Store Name Planet Number Days Q43797754

This question is from “Object Oriented Development”subject.

Q4. Write a class named Planet, which contains two instance variables that store the name of a planet and the number of days

Q4. Write a class named Planet, which contains two instance variables that store the name of a planet and the number of days a planet takes to travel around the Sun. Provide the set and get methods for each instance variables, and an additional method named calculate Age() to calculate your age on that planet. The calculateAge() method should receive an argument that represent your age on Earth. (x/365) / travel days of a planet. Show transcribed image text Q4. Write a class named Planet, which contains two instance variables that store the name of a planet and the number of days a planet takes to travel around the Sun. Provide the set and get methods for each instance variables, and an additional method named calculate Age() to calculate your age on that planet. The calculateAge() method should receive an argument that represent your age on Earth. (x/365) / travel days of a planet.

Expert Answer


Answer to Q4. Write a class named Planet, which contains two instance variables that store the name of a planet and the number of …

OR