|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectAmericanCity
TripCity
public class TripCity
The Trip class is both an executable class and an instantiatable class
that each student must further define for HW4. For a complete description,
of this assignment go to:
http://www.cs.stonybrook.edu/~cse114/hw/HW4.html
This class runs a program that provides a menu to the user such that
they may enter trip information, including the starting city and
destination city, as well as the Latitude/Longitude coordinates of
those respective cities. This program then prints a trip summary
including the trip cities and the trip distance, which should be
calculated by a method in this class.
Author: Ian Sutherland
CSE 114 - Computer Science I - Fall 2009
Stony Brook University
Constructor Summary | |
---|---|
TripCity()
Default Constructor for TripCity, when called it initializes both the city name and the state code to NOWHERE and coordinates to 0. |
|
TripCity(java.lang.String initCity,
java.lang.String initStateCode,
int lat_deg,
int lat_min,
char lat_dir,
int long_deg,
int long_min,
char long_dir)
Default Constructor for TripCity, when called it initializes both the city name, the state code, and coordinates to the provided parameters |
Method Summary | |
---|---|
double |
calcDistance(TripCity otherCity)
Method that returns a Double that represents the distance in miles between two TripCity objects. |
void |
setCity(java.lang.String initCity,
java.lang.String initStateCode,
int lat_deg,
int lat_min,
char lat_dir,
int long_deg,
int long_min,
char long_dir)
Mutator method for TripCity, when called it sets both the city name, the state code, and coordinates to provided paramaters |
java.lang.String |
toString()
Method that returns a string that "textually represents" this object. |
Methods inherited from class AmericanCity |
---|
getCity, getStateCode, isValidStateCode, setCity, setStateCode |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TripCity()
public TripCity(java.lang.String initCity, java.lang.String initStateCode, int lat_deg, int lat_min, char lat_dir, int long_deg, int long_min, char long_dir)
initCity
- The String value used to initialize the city of the
specified AmericanCity.initStateCode
- The String value used to initialize the
state code of the specified AmericanCity.lat_deg
- the int value used for the latitude degreeslat_min
- the int value used for the latitude minuteslat_dir
- the char value used for the latitude direction (n/s)long_deg
- the int value used for the longitude degreeslong_min
- the int value used for the longitude minuteslong_dir
- the char value used for the longitude direction (e/w)Method Detail |
---|
public void setCity(java.lang.String initCity, java.lang.String initStateCode, int lat_deg, int lat_min, char lat_dir, int long_deg, int long_min, char long_dir)
initCity
- The String value used to initialize the city of the
specified AmericanCity.initStateCode
- The String value used to initialize the
state code of the specified AmericanCity.lat_deg
- the int value used for the latitude degreeslat_min
- the int value used for the latitude minuteslat_dir
- the char value used for the latitude direction (n/s)long_deg
- the int value used for the longitude degreeslong_min
- the int value used for the longitude minuteslong_dir
- the char value used for the longitude direction (e/w)public java.lang.String toString()
toString
in class AmericanCity
public double calcDistance(TripCity otherCity)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |