This commit is contained in:
louiscklaw
2025-01-31 19:15:17 +08:00
parent 09adae8c8e
commit 6c60a73f30
1546 changed files with 286918 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
public class Ex2b {
public static void main(String[] args) {
Student stud1 = new Student();
Student stud2 = new Student();
Student stud3 = new Student();
stud1.setId(310567);
stud1.setName("Cheung Siu Ming");
stud1.setScore(87.1);
stud2.setId(451267);
stud2.setName("Ng Wau Man");
stud2.setScore(77.5);
stud3.setId(789014);
stud3.setName("Wong Sui Kai");
stud3.setScore(83.4);
System.out.printf("Student: name=%s id=%d score=%.1f\n", stud1.getName(), stud1.getId(), stud1.getScore());
System.out.printf("Student: name=%s id=%d score=%.1f\n", stud2.getName(), stud2.getId(), stud2.getScore());
System.out.printf("Student: name=%s id=%d score=%.1f\n", stud3.getName(), stud3.getId(), stud3.getScore());
System.out.println("Average Score =" + (stud1.getScore()+stud2.getScore()+stud3.getScore())/ 3);
}
}