Solution
// moPhone.cpp
// A phone number generater for Moe's phone service
#include <iostream>
#include <string>
using namespace std;
int main()
{
const int PHONE_NUM_GEN_FACTOR = 78; // The Phone Number Gender Factor (PNGF)
// These strings represent colors of eyes along with their wavelengths.
const string COLOR_ONE = "475(blue)";
const string COLOR_TWO = "510(green)";
const string COLOR_THREE = "590(orange)";
// Inputs
string fName, lName;
int eyeColor; // Wavelength
bool isFemale;
float height; // in meters, because we do metric!
// Output digits in format a_code-def-extension
int a_code, extension;
int dig1_exchange, dig2_exchange, dig3_exchange; //digits of the exchange(2nd triple of ph no)
int hgtXcol;
cout << "\t\tWelcome to Springfield's new MOEbile phone service!\n"
<< "Please fill out the following billing information:\n"
<< "[First Name]: ";
cin >> fName;
cout << " [Last Name]: ";
cin >> lName;
cout << "Thank you. Your choices for eye color are:\n"
<< "\t"<<COLOR_ONE<<"\n\t"<<COLOR_TWO<<"\n\t"<<COLOR_THREE<<"\n"
<< " [Eye Color]: ";
cin >> eyeColor;
cout << "Your gender choices are:\n"
<< "\t0 (Male)\n\t1 (Female)\n"
<< " [Gender]: ";
cin >> isFemale;
cout << "[Height (m)]: ";
cin >> height;
//First three digits
a_code = eyeColor;
//Second 3, this is trickier
hgtXcol = static_cast<int>(height * eyeColor);
dig1_exchange = (hgtXcol / 100) % 10;
dig2_exchange = (hgtXcol / 10) % 10;
dig3_exchange = hgtXcol % 10;
//And finally:
extension = static_cast<int>(10 * eyeColor + PHONE_NUM_GEN_FACTOR * isFemale + height * height);
//And, the output
cout << endl << "\tCustomer Information" << endl;
cout << "Name:\t\t" << fName + " " + lName << endl;
cout << "Phone Number:\t(" << a_code << ") " << dig1_exchange << dig2_exchange << dig3_exchange
<< "-" << extension << endl;
cout << "Our Motto:\tSpringfield MOEbile: something else you should avoid "
<< "while driving" << endl;
return 0;
}