Skip to content

Instantly share code, notes, and snippets.

@clara-shin
Created May 30, 2018 07:56
Show Gist options
  • Save clara-shin/2c0bb68d716e25de549ff5a401acc003 to your computer and use it in GitHub Desktop.
Save clara-shin/2c0bb68d716e25de549ff5a401acc003 to your computer and use it in GitHub Desktop.
성적처리 자바
class Grade {
int e; //영어 성적을 위한 변수
int m; //수학 성적을 위한 변수
void output_grade() { //총점을 구하는 메소드
System.out.println(e+m);
}
}
public class GradeOutput {
public static void main(String args[]) {
Grade g1, g2; //2명의 성적을 표현하는 객체
g1 = new Grade( );
g2 = new Grade( );
g1.e = 90; //점수 입력
g1.m = 85;
g2.e = 80;
g2.m = 80;
g1.output_grade( );
g2.output_grade( );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment