All pastes #373958 Raw Edit

Stuff

public text v1 · immutable
#373958 ·published 2007-02-27 03:36 UTC
rendered paste body
#include <iostream>
using namespace std;

// There will be three functions performing the
// Hat size, Jacket size, and Waist size calculations
// All of which are designated before and after main.

// Algorithm:
// Get the users height, weight, age.
// Caclculate the HatSize, JacketSize, and WaistSize
// given the coorelating formulas provided by Hare
// for each seperate formula making a function for each.


// hat func
struct HatSize
{
    double Ht, Wt;
};
HatSize GetInputs();
// PRE: given inputs
// POST: do the formular
double Sizes(double Ht, double Wt)


// jacket func
struct JacketSize
{
    double Ht, Wt, Age;
};
JacketSize GetInputs();
// PRE: given inputs
// POST: do the formula
int JacketSize(int Ht, int Wt, int Age)


// waist func
struct WaistSize
{
    double Ht, Wt, Age;
};
WaistSize GetInputs();
// PRE: given inputs
// POST: do the formula
double WaistSize(double Ht, double Wt, double Age)

int main()
{
    int Ht, Wt, Age, CalcdHatSize, CalcdJacketSize, CalcdWaistSize ;

    cout << "Hat size is " << HatSize(Ht, Wt) << endl;
    
    cout << "Jacket size is " << JacketSize(Ht, Wt) << endl;
    
    cout << "Waist size is " << WaistSize(Ht, Wt) << endl;
    

    return 0;
}

HatSize GetInputs()
{
    HatSize inputsHS;
    cout << "What is your weight in pounds?" ;
    cin >> Wt;
    cout << "What is your height in inches?" ;
    cin >> Ht;
    return inputsHS;
}

double HatSize(double Ht, double Wt)
{
    double CalcdHS;
    CalcdHS = ((Wt / Ht) * 2.9); //equation for a person hat size
    return CalcdHS;              // returning the value produced from the given inputs form main
}

JacketSize GetInputs()
{
    JacketSize inputsJS;
 
    return inputsJS;
}

int JacketSize(int Ht, int Wt, int Age)
{
    double CalcdJS;
    CalcdJS = Ht * Wt / 288.0; // equation of persons jacket size
    if (Age > 30)
            CalcdWS += ((Age - 30) / 10) * 1.0/8.0 //iff over 30 then adjust made
    return (int) (CalcdJS + 0.5);
}
// jacket conversion if over 30 years old return adjusted value
  
    

WaistSize GetInputs()
{
    WaistSize inputsWS;

    return inputsWS;
}

int WaistSize(int Ht, int Wt, int Age)
{
    double CalcdWS;
    CalcdWS = Wt / 5.7;       // formula for waist size
    if (Age > 28)
            CalcdWS += ((Age - 28) / 2) * 1.0/10.0; // if over 28 adjuster per 2 years by 1/10

    return (int) (CalcdWS + 0.5);
}
// waist conversion is over 28 years old return the adjusted value