CS 117, Introduction to Computer Science
Project 7: Mars Probe
Overview
Last year, 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 project, you will write C++ code for
a class to represent better Mars probes than the one we lost.
Details
You should create a class named Mars_Probe. 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 update_metric(double x, double y, double z);
void update_english(double x, double y, double z);
update_metric will take new coordinates in kilometers, and store it directly.
update_english 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 a method for obtaining the coordinates:
void get_coords(double &x, double &y, double &z);
Make appropriate use of the private and public visibility modifiers, and
make sure to include a constructor.
What to turn in
Like the Coconuts project, you should only turn in the class itself, not
the main function -- but this time we'll be a little more sophisticated
about how we do it. You should put all the code for your class in a file
called Mars_Probe.cpp. Your main function should go in a file called project7.cpp.
At the very top of project7.cpp, you should put this line of code:
#include "Mars_Probe.cpp"
This way, you can keep your code for the class separate. Good luck!