public class StudentTest2
{
public static void main(String args[])
{
int a = 10;
Student s = new Student("홍길동",1,1,100,60,76);
System.out.println(s.info());
}
}
class Student
{
String name;
int ban, num , eng , math, kor;
public Student(String name, int ban, int num, int eng, int math, int kor)
{
this.name = name;
this.ban = ban;
this.num = num;
this.eng = eng;
this.math = math;
this.kor = kor;
}
public int getTotal()
{
int total;
total = eng + math + kor;
return total;
}
public float getAverage()
{
float average;
average = (int)(getTotal()/3f*10+0.5f)/10f;
return average;
}
public String info()
{
return name+","+ban+","+num+","+"eng"+","+math+","
+kor+","+getTotal()+","+getAverage();
}
}
|