/****************************************************************
example 5 -- length.cpp
    feet/inches manager
****************************************************************/
#include "length.h"

length::length(const int& f, const int& i) {
    if (f > 0)
        feet = f;
    else
        feet = 0;

    if (i > 0) {
        feet += i / 12;
        inches = i % 12;
    }
    else
        inches = 0;
}

void length::grow(const float& f) {
    feet += (int)f;
    int temp = inches + f * 12;
    inches = temp % 12;
}

ostream& operator<<(ostream& out, const length& l) {
    l.show(out);
    return out;
}