Reference no: EM133107618 , Length: word count:2500
Dwarf Planets Database
Introduction
The objective of this assignment is to implement an object-oriented program (using Java) to manage a database of objects containing information about dwarf planets in our solar system.
Specification
Your database will hold nine dwarf planets with the attributes listed below. See the file "dwarf_planet_data.csv" for the complete data.
When run, the program will display a menu of actions to the user, including one that exits the program. Until the user chooses to exit, the menu is displayed again after each action is completed. A working menu is supplied in the file Interface.java - you should modify this code for your own answer. Do not completely re-write it, but add to it where necessary.
Write code to do the following. Most of this code will be added to the file Interface.java - add code to the other two classes when appropriate.
Menu option 1. Create the nine dwarf planet objects.
This involves
a. Completing the DwarfPlanet.java class with the attributes listed below. You should write getter (accessor) and setter (mutator) methods for all attributes.
b. The DwarfPlanet class should have two constructor methods, one which will set the values of all attributes from parameters in its call, the other which expects no parameters.
c. Write code to create the objects by using the first constructor. Hard-code the data into your program - use the data from the dwarf_planet_data.csv file.
Menu option 2. List all the data you have entered into the database.
That is, all attributes for all objects.
Menu option 3. Delete the dwarf planet Eris from the database.
Menu option 4. Manually add the dwarf planet Eris back again.
This means reading all the attribute values from the keyboard. When the user has finished, the program should display the values added.
Menu option 5. Change the number of moons of Sedna to 1.
Do this by
a. Reading the new value from the keyboard
b. Changing the value in the database
c. Displaying the values of all attributes for this dwarf planet.
Menu option 6. Calculate the average (mean) diameter for the Kuiper belt dwarf planets.
Menu option 7. List the orbital radius and orbital period for a given non-Kuiper belt dwarf planet.
The dwarf planet to be used should be read from the keyboard.
Menu option 8. List names of all dwarf planets with a radius greater than a value read from the keyboard.
Menu option 9. (Challenge)
Write a Region class and instantiate an object called Kuiper. Add the three dwarf planets to it as attributes of type DwarfPlanet. When all three are added, display the values of the attributes for all three by calling a method in the Region class.
Menu option 10. (Challenge)
Implement part of the interface using GUI components.
Task. Provide a UML class diagram of your program.
Additional program requirements
The program should consist of three classes with the following names and instance variables (attributes). You may need other variables in these classes.
Class name: DwarfPlanet
name - the name of the dwarf planet
region - the region of the solar system, here we use "Kuiper belt" or "Other" only. orbitalRadius - the radius of the orbit, units Astronomical Units (AU). One AU is the
distance of the Earth from the Sun.
orbitalPeriod - the time taken to complete one orbit of the Sun, units years. diameter - the diameter of the object, units km.
mass - the mass of the object, units 1021kg
moons - the number of objects orbiting the dwarf planet.
Class name: Region
Attributes of type DwarfPlanet.
Class name: Interface
The class with the main() method.
All instance variables of your classes should be private (this is imposed so that you apply the principles of encapsulation).
Your classes will need methods to provide the required functionalities. The only class which should have a main method is Interface, which should create an instance of the class Interface, and call a method run(), which will display the menu to the user (this is provided for you in the files you should start with). This class will be the only one that takes input from and sends output to the user. It may do so using either TIO or GUI methods (your choice). A template is shown below and the file Interface.java is available for you to use.
public class Interface { private void run(){
// All your code here ...
}
// Create an instance of this class and run the code above public static void main(String[] args){
Interface infFace = new Interface(); intFace.run();
}
}
You do not need to use arrays
The use of arrays would be appropriate for this assignment, but as we have not covered arrays in the lecture material yet, you do not have to use arrays in this assignment. No additional marks will be given for the use of arrays.
Attachment:- Dwarf Planets Database.rar