AfterGirl V1.0 (numnum, please revise my program)

mrviceroy (杀人者Daniel是也)
const float SUCCESSFUL = 1.5;

class girl
{
public:
girl(float looking, float age){ m_looking = looking; m_age = age; };

float getLooking(){ return m_looking; };
float getAge(){ return m_age; };
private:
float m_looking;
float m_age;
};

class boy
{
public:
boy(float money, float looking){m_money=money; m_looking = looking; m_luck = rand()%100;};
bool suit(girl GIRL);
private:
float m_money;
float m_looking;
float m_luck;
};

bool boy::suit(girl GIRL)
{
float temp = m_money/100 + m_looking/100 + m_luck/100 - GIRL.getLooking()/100 - (30 - GIRL.getAge())/10;
if ( temp > SUCCESSFUL )
return true;
else
return false;
};


int main(int argc, char* argv[])
{
srand( (unsigned)time( NULL ) );

girl *pGirl = new girl(100, 20);
boy *pBoy = new boy(70, 80);

if ( pBoy->suit(*pGirl) )
printf("I made a girl friend. \n");
else
printf("I will go for the next one.\n");

return 0;
}
(#128168@0)
2001-7-11 -05:00

回到话题: 请教:谁能出一个测试OOA或OOD的题目?最好明了简单(好表达)但是不是那么容易分析精屁(难回答)的题目?谢谢!

回到论坛: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论

URL:   
http://www.rolia.net/zh/post.php?f=0&p=128168