public class StudentMain {
public static void main(String[] args){
//1.학생객체생성
//2.학생객체 데이타셋팅(점수,이름,학번)
//3.총점,평균,평점구하기
//4.학생객체데이타 출력
Student st = new Student();
st.setData("haha",1,60,50,70);
st.tot();
st.avg();
st.grad();
st.print();
}
}
-------------------------------------------
public class Student {
public String no ;
public int undergrad ;
public int kor ;
public int eng ;
public int math ;
public int tot ;
public int avg ;
public char grad ;
public void tot(){
this.tot=this.kor+this.eng+this.math;
}
public void avg(){
this.avg=tot/3;
}
public void grad(){
char hakjum=' ';
if(this.avg>=90){
hakjum ='a';
}else if(this.avg>=80){
hakjum ='b';
}else if(this.avg>=70){
hakjum ='c';
}else if(this.avg>=60){
hakjum ='d';
}else if(this.avg>=50){
hakjum ='e';
}
this.grad=hakjum;
}
public void setData(String no, int undergrad, int kor, int eng, int math){
this.no=no;
this.undergrad=undergrad;
this.kor=kor;
this.eng=eng;
this.math=math;
}
public void print(){
System.out.println("이름"+this.no);
System.out.println("학번"+this.undergrad);
System.out.println("국어"+this.kor);
System.out.println("영어"+this.eng);
System.out.println("수학"+this.math);
System.out.println("총점"+this.tot);
System.out.println("평균"+this.avg);
System.out.println("평점"+this.grad);
}
public int tot1(int a, int b, int c){
return a+b+c;
}
public int avg1(int a){
return (tot/3);
}
public int grad1(int a){
char hakjum=' ';
if(avg<0 || avg>100){
if(avg>=90){
hakjum ='a';
}else if(avg>=80){
hakjum ='b';
}else if(avg>=70){
hakjum ='c';
}else if(avg>=60){
hakjum ='d';
}else if(avg>=50){
hakjum ='e';
}
};
return hakjum;
}
}
2013년 2월 22일 금요일
피드 구독하기:
댓글 (Atom)
UPBIT is a South Korean company, and people died of suicide cause of coin investment.
UPBIT is a South Korean company, and people died of suicide cause of coin. The company helps the people who control the market price manipu...
-
프루나는 이제 믿을만한 공유가 안되고 있다. 젠장. 영화 다운 받아보면 전부 야동이나 포르노류 밖에는 없다. 신고되어 있는 자료부터 보지만 신고가 안되어 있는 것은 제대로 다운도 되지 않는다. 이젠 유료 사이트를 믿을 수 밖엔... ...
-
SELinux 불린 값을 이용해서 SELinux.getBooleanValue("xxxx") SELinux.setBooleanValue("xxxx", yyyy); Policy 에도 if 문을 줄...
-
간만에 아침에 운동 갔다가 일하고 나서 피곤한 몸을 이끌고 쓰고 있다. 새벽 4시 50분에 일어났는데 나도 모르게 운동을 하러 나가게 되었다. 막 전역 했을 때 28인치던 내 허리가 지금은 36에 육박한다. 우스운 것이 배만 ...
잘하눼~
답글삭제