Question: Can anyone solve this for me using java programming language? Exercise: A planet has a name, an orbit, a diameter and a mass. Define a
Can anyone solve this for me using java programming language?
Exercise:
A planet has a name, an orbit, a diameter and a mass. Define a class called Planet, and provide required constructors, accessor and mutator methods. Override the following methods that are defined in the Object class
equals method that checks reference equality and returns a boolean value
clone method that creates a copy of an object and returns it
toString() method that returns a string containing object details
Develop a driver class to do the following
1.Creates an array planets using the values provided in the file input.txt. Each line of the text represent name, orbit(distance from the sun) , diameter and mass
2. Print the name of the heaviest planet
3. Print name of the farthest planet from Sun
4. Create a clone of a planet
5. Check if two planets are equal
6. Print details of all planets ( by invoking toString() method implicitly)
Sample input(planet.txt):
Mercury 57910000.0 4880.0 3.30e23
Venus 108200000.0 12103.6 4.869e24
Earth 149600000.0 12756.3 5.972e24
Mars 227940000.0 6794.0 6.4219e23
Jupiter 778330000.0 142984 1.900e27
Saturn 1429400000.0 120536 5.68e26
Uranus 2870990000.0 51118.0 8.683e25
Neptune 4504000000.0 49532.0 1.0247e26
Pluto 5913520000.0 2274.0 1.27e22
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
