-
Notifications
You must be signed in to change notification settings - Fork 0
/
EnglishStudent.java
38 lines (30 loc) · 1.12 KB
/
EnglishStudent.java
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
26
27
28
29
30
31
32
33
34
35
36
37
38
import java.io.*;
import java.util.Scanner;
import java.util.ArrayList;
public class EnglishStudent extends Student {
// Private fields to store English student grades
private double termPaperGrade;
private double midtermGrade;
private double finalExamGrade;
// Constructor to initialize student data and English student grades
public EnglishStudent(String firstName, String lastName, double termPaperGrade, double midtermGrade, double finalExamGrade) {
super(firstName, lastName, "English");
this.termPaperGrade = termPaperGrade;
this.midtermGrade = midtermGrade;
this.finalExamGrade = finalExamGrade;
}
// Public getter methods to access English student grades from outside the class
public double getTermPaperGrade() {
return termPaperGrade;
}
public double getMidtermGrade() {
return midtermGrade;
}
public double getFinalExamGrade() {
return finalExamGrade;
}
// Public method to calculate and return the student's final average
public double calculateAverage() {
return (termPaperGrade * 0.3) + (midtermGrade * 0.3) + (finalExamGrade * 0.4);
}
}