Sungjuk.java
package exam14;
public class Sungjuk {
private String name = "홍길동";
private int[] jumsu = {60, 70, 80, 90};
private int total;
public void setName(String n) {name = n;}
public String getName() {return name;}
public int Total() {
for(int i=0; i<4; i++) {
int total = 0;
total += jumsu[i];
}
return total;
}
public float Avg() {return (total)/4.f;}
}
SungjukExample.java
package exam14;
public class SungjukExample {
public static void main(String[] args) {
Sungjuk sungjuk = new Sungjuk();
System.out.println("이름 : " + sungjuk.getName());
System.out.println("총점 : " + sungjuk.Total());
System.out.println("총점 : " + sungjuk.Avg());
}
}
세상을 링크하라!!! 모든 링크를 한 자리에...
링크닷컴: https://linkdotcom.mycafe24.com/
유용한 링크, 링크닷컴 #무료 #링크사이트 #링크사이트
컴퓨터 및 일반 유용한 링크들을 모아 놓았습니다. 지금 바로 확인하세요!
linkdotcom.mycafe24.com