// Enum.cpp -- This program has you enter a number for a planet and your weight and it outputs your weight 
//			   for that particular planet.
// CSCI 111-03
// Source -- Open Source

#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <cstdlib>
#include <fstream>
using namespace std;

//global variables and types
enum PlanetType { MERCURY, VENUS, EARTH, MOON, MARS, JUPITER, SATURN, URANUS, NEPTUNE, PLUTO };
float weight;

//prototypes
void PrintPlanet(PlanetType, float);

int main() {

	//lab name and number
	cout << "Dylan Brucki -- Lab 8" << endl << endl;

	//variables
	int userInput;
	PlanetType planet;

	//prompt user for a planet number
	do {
		cout << "1) Mercury" << endl;
		cout << "2) Venus" << endl;
		cout << "3) Earth" << endl;
		cout << "4) Moon" << endl;
		cout << "5) Mars" << endl;
		cout << "6) Jupiter" << endl;
		cout << "7) Saturn" << endl;
		cout << "8) Uranus" << endl;
		cout << "9) Neptune" << endl;
		cout << "10) Pluto" << endl;
		cout << "Please enter a number from 1 to 10: ";
		cin >> userInput;
	} while ((userInput < 1) || (userInput > 10));

	//promt user for weight
	cout << "Please enter your weight: ";
	cin >> weight;

	//use the number to determine which planet has been selected
	planet = PlanetType(userInput - 1);

	//call PrintPlanet to print out the user's choice
	PrintPlanet(planet, weight);

	//close program
	cout << endl << endl;
	system("pause");
	return 0;
}

// statement to calculate weights and print out planets
void PrintPlanet(PlanetType p, float weight) {

	switch (p)
	{
	case MERCURY:	cout << "On Mercury you weigh " << weight*0.4155 << "lbs";
		break;
	case VENUS:		cout << "On Venus you weigh " << weight*0.8975 << "lbs";
		break;
	case EARTH:		cout << "On Earth you weigh " << weight*1.0 << "lbs";
		break;
	case MOON:		cout << "On the moon you weigh " << weight*0.166 << "lbs";
		break;
	case MARS:		cout << "On Mars you weigh " << weight*0.3507 << "lbs";
		break;
	case JUPITER:	cout << "On Jupiter you weigh " << weight*2.5374 << "lbs";
		break;
	case SATURN:	cout << "On Saturn you weigh " << weight*1.0677 << "lbs";
		break;
	case URANUS:	cout << "On Uranus you weigh " << weight*0.8947 << "lbs";
		break;
	case NEPTUNE:	cout << "On Neptune you weigh " << weight*1.1794 << "lbs";
		break;
	case PLUTO:		cout << "On Pluto you weigh " << weight*0.0899 << "lbs";
		break;
	default:		cout << "Not a valid planet";
		break;
	}

	cout << endl;
}