Hint
The constructor Student(String name, int maths, int language, int computing) sets all attributes at once. The average is a real number: divide by 3.0. For two decimal places use String.format(Locale.US, "%.2f", x).
Solution (Java)
import java.util.Locale;
import java.util.Scanner;
class Student {
private String name;
private int maths, language, computing;
Student(String name, int maths, int language, int computing) {
this.name = name;
this.maths = maths;
this.language = language;
this.computing = computing;
}
String getName() { return name; }
double average() {
return (maths + language + computing) / 3.0; // 3.0 -> real division
}
public String toString() {
return name + ", average " + String.format(Locale.US, "%.2f", average());
}
}
public class StudentAverage {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Student s1 = new Student(sc.next(), sc.nextInt(), sc.nextInt(), sc.nextInt());
Student s2 = new Student(sc.next(), sc.nextInt(), sc.nextInt(), sc.nextInt());
System.out.println(s1);
System.out.println(s2);
Student better = (s1.average() >= s2.average()) ? s1 : s2;
System.out.println("Better average: " + better.getName());
}
}