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...
-
프루나는 이제 믿을만한 공유가 안되고 있다. 젠장. 영화 다운 받아보면 전부 야동이나 포르노류 밖에는 없다. 신고되어 있는 자료부터 보지만 신고가 안되어 있는 것은 제대로 다운도 되지 않는다. 이젠 유료 사이트를 믿을 수 밖엔... ...
-
Intel의 새로운 MMX - "KNI" KNI 는 Katmai New Instruction 의 약자이다 . 아는 분들은 잘 알고있겠지만 KATMAI( 이하 카트마이로 부름 ) 는 인텔의 다음번 펜티엄...
-
C:\program files\ 베이비론 폴더가 있다. 브라우저 창 다닫고 지우고 다시 실행하면 없어진다.
잘하눼~
답글삭제