Question: This program should be written in Java. Solar System Draw the UML for the following classes, except BigBang, being sure to show the aggregation lines




This program should be written in Java.
Solar System Draw the UML for the following classes, except BigBang, being sure to show the aggregation lines and diamonds. Append to the end of the homework(10) Then do the program. (70 points total) The following program is made up of four classes, Sun, Planet, SolarSystem, and BigBang. You should use these as the input file. Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune Nemesis Submit the UML for Sun, Planet, and SolarSystem showing the aggregation via appropriate connector Submit each of the four classes as a separate .java file. class Sun (10 points) Has three instance variables: String sunName the name of the Sun int sunAge the age of the Sun Random randy Default constructor sets the sunName to unknown by calling the mutator method for the variable A constructor with the Sun's name as an input variable which: Calls a mutator to set the Sun's name Calls a mutator to set the Sun's age with a randomly generated age of between one billion and two billion years, inclusively. Methods: Mutators and accessors for the sunName and sunAge A toString method that returns the String as follows (name and age will change): The sun named Sunny Boy is 1,376,240,614 years old class Planet (10 points) Has three instance variables: String planetName the name of the Planet int planetTons the weight of the planet in tons Random randy Default constructor sets the planetName to unknown by calling the mutator method for the variable A constructor with the Planet's name as an input variable which: Calls a mutator to set the Planet's name Calls a mutator to set the Planet's weight in tons with a randomly generated weight of between ten million and eighty million tons, inclusively. Methods: Mutators and accessors for the planetName and planetTons A toString method that returns the String as follows (name and tons will change): The planet named Nemesis weighs 72,018,542 tons An equals method that compares two Planets based on both name and weight in tons. class SolarSystem (30 points) Has the following three instance variables: String solSystemName Sun sol An ArrayList containing references to Planet objects named planetList A default constructor that: Sets the SolarSystem name to unknown by calling the mutator method for the variable Calls the default Sun construct to create sol A constructor with two parameters for the Solar System name and it's Sun's name which: Calls a mutator to set the Solar System's name Creates a Sun referred to by sol by calling a Sun constructor with the Sun's name. Calls createPlanets (see below) to create the planets. Methods: A mutator and accessor for the SolarSystem name. A toString method that returns a String with output to produce the output (except for the equals statements) as shown in Sample output. (Includes the Solar System name, Sun's name and age, and the name and weight for each planet. The createPlanets method with no parameters and a void return value which: Creates a Scanner to read data from the keyboard. Reads in a file name with the names of the planets. (you can use the planets.txt file in Programs/Lesson 2/Homework tab) Creates a Scanner for the planet name's file. For each planet name in the file create a Planet and add it to the planetList. The getNum Planets method with no parameters which return the size of the planetList. The getPlanet method which accepts an int index as a parameter and returns null or a reference to a Planet as follows: If the index is out of range for the planetList print: Planet doesn't exist Return null Otherwise return reference to the planet at the index. class BigBang (20 points) Has a main method only. Creates a Scanner to read from the keyboard Reads in the name of the SolarSystem and the name of the Sun Create a new SolarSystem with the SolarSystem and Sun name. Print out the Solar System If there is more than one planet Compare each planet (except the first planet) to the first planet in the queue. If any planet equals the first planet print it out otherwise print: There is no planet that matches the first planet Then set the name and tonnage of the last planet to the first planet Then see if the two planets are equal and print as follows: The planet named Mercury weighs 75,504,385 tons equals the first planet in the ArrayList else Print There are no planets to compare A sample input/output may look like below. Part in italics is what the toString in SolarSystem returns. Please enter the name of the Solar System: Andromeda One Please enter the name of the Sun Light Star Please enter file to read in planetList from: planets.txt The name of this solar system is Andromeda One The sun named Light Star is 1,723,009,977 years old The planet named Mercury weighs 75,808,617 tons The planet named Venus weighs 70,936,151 tons The planet named Earth weighs 72,486,569 tons
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
