Class ConditionFactor{
private float presentWeight; // 현재 체중
private float height; // 현재 신장
private float mheight; // 현재 신장을 m로 표현
private float standardWeight; // 표준 체중
private int bmi; // 비만지수
private int sex; // 성별(1 : 남자, 2 : 여자)
private int man = 22; // 22
private int woman = 21; // 21
// 생성자1
public ConiditionFactor()
{
this(173, 64, 1); // 아둔이의 스팩
}
// 생성자2
public ConiditionFactor(folat PresentWeight, float heightm,int sex)
{
this.PresentWeight = Presentweight;
this.height = height;
this.sex = sex;
}
//(메서드1) 현재 체중 세터 메서드
//(메서드2) 현재 체중 게터 메서드
//(메서드3) 현재 신장 세터 메서드
//(메셔드4) 현재 신장 게터 메서드
//(메서드5) 성별 세터 메서드
//(메서드6) 성별 게터 메서드
// (메서드7) 표준 체중을 계산하는 메서드
public void calStandardWeight()
{
if(sex == 1)
standardWeight = calMHeight() * calMHeight() * man
else if (sex == 2)
standardWeight = calMHeight() * calMHeight() * woman
else
시스템.아웃.프린트("Suck My AssHole!!!");
종료;
}
// (메서드8) 비만지수를 계산하는 메서드
public void calBmi()
{
bmi = (int)Math.round((presentWeight / standardWeight) * 100);
}
// (메서드9) 현재 신장을 m로 표현하는 메서드
public folat calMHeight()
{
mheight = height / 100;
return mheight;
}
// (메서드10) 비만지수를 계산하고 비만도를 보여주는 메소드
public void calDisPlay()
{
케이스 bmi
스위치
스위치
스위치
}
// 메서드(11) 한방에 처리!!
public void startCal()
{
calStandardWeight();
calMHeight();
calMHeight();
}
--------------------------
Class 비만도계산기{
키,몸무게 성별을 변수선언하여 초기값 설정하거나 키보드로 값을 받는다.
ConditionFactor Adun =
스태틱 메인{
Adun = 뉴 ConditionFactor(키, 몸무게, 성별)
Adun.startCal
}
}
방금 메모장으로짜서 오타수정안했고 귀찬은건 코딩안했다.