Solution

//File: pitchfork.cpp Class: CS 1570

//Purpose: This program helps groundskeeper Willie select

// the correct pitchfork

#include<iostream>

using namespace std;

const int IDIOT_SCORE = 8;

const int FORK_INDEXER = 10;

int main()

{

// ======= Declarations =======

int stinkFactor = 0;

float pressure = 0;

float tailLength = 0;

float weight = 0;

float forkLength = 0;

int forkChoice = 0;

// ======= Welcome and Input =======

cout<<"\nHello Willie, input the stats of the 'possum"

<<"\nand I will help you choose the proper pitchfork"<<endl;

cout<<"\nHow heavy is that varmint (in pounds)? ";

cin>>weight;

cout<<"\nHow long is that thar tail (in inches)? ";

cin>>tailLength;

cout<<"\nJes' how stinky is 'e (on a scale of 1 - 10)? ";

cin>>stinkFactor;

cout<<"\nCheck that barometer thingamajiggy: ";

cin>>pressure;

// ======= Calculations =======

forkLength = (3*tailLength + weight)*stinkFactor/IDIOT_SCORE

+ 30*(stinkFactor/pressure);

forkChoice = static_cast<int>(forkLength/FORK_INDEXER);

// ======= Output and Sign-off =======

cout<<"\nFor a "<<weight<<"lb. 'possum with a "<<tailLength

<<"in. tail and a stink of "<<stinkFactor

<<"\nand today's barometric pressure of "<<pressure<<"..."

<<"\n\nYou want a fork with a "<<forkLength<<"in. handle so grab fork #"

<<forkChoice<<endl;

cout<<"\nThanks for using the dead 'possum pitchfork chooser."

<<"\nHave a nice day."<<endl<<endl;

return 0;

}