/*
File name: hw2.cpp
Author: Bo Bayles
E-mail address: bmb3h6@umr.edu
Description: This program calculates monkey nutritional needs
  based on age and tail length.
*/

#include <iostream>
using namespace std;
//Include iostream and use standard namespace for cin and cout.

int main()
//Begin program execution.
{
  float fWeight, fAge, fConsumed;
  char cTail;
  //Declare floats for the numbers and a char for the tail size.

  cout << "\n This program will calculate whether or not your ";
  cout << "pet monkey is losing or gaining weight." << endl;
  //Output a greeting.

  cout << "\n Enter your monkey's weight in pounds: ";
  cin >> fWeight;

  cout << "\n Enter your monkey's age in years: ";
  cin >> fAge;

  cout << "\n Enter an S if your monkey has a short tail " << endl;
  cout << "or an L if your monkey has a long tail: ";
  cin >> cTail;

  cout << "\n Enter how many bananas your monkey ate today: ";
  cin >> fConsumed;
  //Prompt the user to initialize all the variables.

  if (cTail == 'L')
  //This branch is for long-tailed monkeys.
  {
    if (fAge < 5)
    //This branch is for young long-tailed monkeys.
    {
      cout << "\n This is a young long-tailed monkey." << endl;
      //Output what type of monkey with which we're dealing.

      if (fConsumed > ((fWeight * 3)/5))
        cout << "\n The monkey is gaining weight." << endl;

      else if (fConsumed < ((fWeight * 3)/5))
        cout << "\n The monkey is losing weight." << endl;

      else if (fConsumed == ((fWeight * 3)/5))
        cout << "\n The monkey is keeping the same weight." << endl;   
        /* Ratio is 3 to 5 for this type of monkey, so if it's eaten
          more it's going to gain, less it's going to lose, or equal
          will stay the same.
        */
    }
    
    /* The rest of the branches follow the same pattern as this one.
      The monkey's weight is multiplied by the appropriate banana to
      weight ratio, and then compared to the number it ate.
    */ 

    else if (fAge >= 5)
    //This branch is for older long-tailed monkeys.
    {
      cout << "\n This is an older long-tailed monkey." << endl;

      if (fConsumed > ((fWeight * 2)/5))
        cout << "\n The monkey is gaining weight." << endl;

      else if (fConsumed < ((fWeight * 2)/5))
        cout << "\n The monkey is losing weight." << endl;

      else if (fConsumed == ((fWeight * 2)/5))
        cout << "\n The monkey is keeping the same weight." << endl;   
    }
  }
  else if (cTail == 'S')
  //This branch is for short-tailed monkeys.
  {
    if (fAge < 5)
    //This branch is for young short-tailed monkeys.
    {
      cout << "\n This is a young short-tailed monkey." << endl;

      if (fConsumed > ((fWeight * 2.5)/5))
        cout << "\n The monkey is gaining weight." << endl;

      else if (fConsumed < ((fWeight * 2.5)/5))
        cout << "\n The monkey is losing weight." << endl;

      else if (fConsumed == ((fWeight * 2.5)/5))
        cout << "\n The monkey is keeping the same weight." << endl;
    }
    else if (fAge >= 5)
    //This branch is for older short-tailed monkeys.
    {
      cout << "\n This is an older short-tailed monkey." << endl;

      if (fConsumed > ((fWeight * 1.5)/5))
        cout << "\n The monkey is gaining weight." << endl;

      else if (fConsumed < ((fWeight * 1.5)/5))
        cout << "\n The monkey is losing weight." << endl;

      else if (fConsumed == ((fWeight * 1.5)/5))
        cout << "\n The monkey is keeping the same weight." << endl;
    }
  }

  cout << "\n Goodbye. Hope your monkey is doing well." << endl;
  return 0;
  //Output the closing message and exit normally.
}

