student
. From the "Edit"
menu, choose "Add Class From File." Go to the "T" disk drive at the top,
then go into the "javalibs" folder, then go into the "dmusican" folder.
Double click on the file named Student.java.
new Student()
option. Then
inspect the object to see the values of its attributes.
new Student(anIdNumber,aFirstName,aFamilyName,anAge)
option. Give the attributes some values as the object is created. Inspect the object to see if it worked.
private String firstName;
to say
public String firstName;
main
method in StudentInfo so that it asks a
user for an idNumber, firstName, familyName, and age for three different
students, each of which gets stored in an individual student object.
Output a summary of each student back to the user. In September of 1999, NASA lost a Mars probe because it had been improperly programmed. The coordinates were accidentally given to it in the English system instead of in the metric system. For this lab, you will create a class to represent better Mars probes than the one we lost.
In a new project, you should create a class named MarsProbe. Within this class, you should have data members which represent destination coordinates (in kilometers), but the class should provide two different methods for updating the coordinates:
void updateMetric(double x, double y, double z);
void updateEnglish(double x, double y, double z);
updateMetric will take new coordinates in kilometers, and store it directly. updateEnglish will take new coordinates in miles, and convert it to kilometers before storing it. (Useful information: 1 mile = 1.6094 kilometers.)
You should also include methods for obtaining the coordinates:
double getXCoord();
double getYCoord();
double getZCoord();
Make appropriate use of the private and public visibility modifiers, and make sure to include a constructor. You should make the 1.6094 conversion factor a private data value in the MarsProbe class. Why? What would be the ramifications if you made it public?
Check the javadoc that BlueJ generates for your class. Add comments to your program appropriately so that the javadoc contains useful information.
Turn in both your MarsProbe class as well as another class called LaunchProbe. LaunchProbe should have a main method that asks the user for X, Y, Z coordinates in English units, stores them appropriately in a MarsProbe object, then outputs the coordinates back to the user in kilometers.