728x90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import java.util.Scanner;
public class Student {
Scanner sc = new Scanner(System.in);
String name; //ํ์์ด๋ฆ
int ban; //๋ฐ
int no; //๋ฒํธ
int kor; //๊ตญ์ด์ ์
int eng; //์์ด์ ์
int math; //์ํ์ ์
int getTotal() {
return kor + eng + math;}
float getAverage() {
return (((getTotal()*100/3+5)/10)/10f);
}
}
|
cs |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
public class MainClass {
public static void main(String[] args) {
Student s = new Student();
s.name = "ํ๊ธธ๋";
s.ban = 1;
s.no = 1;
s.kor = 100;
s.eng = 60;
s.math = 76;
System.out.println("์ด๋ฆ:"+s.name);
System.out.println("์ด์ :"+s.getTotal() );
System.out.println("ํ๊ท :"+s.getAverage( ) );
}
}
|
cs |
๋๊ธ