#include <iostream>
using namespace std;
class WeightControl
{
private:
double height, weight;
int WeightStatus;
public:
void setHeight(const double h);
void setWeight(const double w);
double getHeight();
double getWeight();
int StdWeight();
int getWeightStatus();
};
int main()
{
WeightControl wc;
wc.setHeight(170);
wc.setWeight(80);
wc.StdWeight();
cout << wc.getWeightStatus() << endl;
return 0;
}
void WeightControl::setHeight(const double h)
{
if ( h > 0)
{
height = h;
}
else
{
height = 150;
}
}
void WeightControl::setWeight(const double w)
{
// 0 < weight 조건
if ( w > 0)
{
weight = w;
}
else
{
weight = 60;
}
}
double WeightControl::getHeight()
{
return height;
}
double WeightControl::getWeight()
{
return weight;
}
int WeightControl::StdWeight()
{
if ( (height - 100) < weight )
{
WeightStatus = 1;
}
else
{
WeightStatus = 0;
}
WeightStatus = -1;
return 0;
}
int WeightControl::getWeightStatus()
{
return WeightStatus;
}
'실습과제 모음' 카테고리의 다른 글
CPP 실습예제 (0) | 2014.01.21 |
---|---|
CPP GeometricObject (0) | 2014.01.21 |
CPP 실습 (0) | 2014.01.15 |
JAVA 실습 과제 2014 01 02 (0) | 2014.01.02 |
반복문 실습 별찍기 (0) | 2013.12.31 |