Question: In java Please You will be taking the student.java file and implementing the student ( ) constructor and the getGrade ( ) method. Part One:

In java Please
You will be taking the student.java file and implementing the student() constructor and the getGrade() method.
Part One:
Constructor:
The constructors role will be to initiate the object variables examGrade1, examGrade2, examGrade3, and homeworkGrade. Currently the constructor is setting the values equal to 0. Change the constructor so that the variables are based on the file.
Example:
The file student1.txt have values
Exam One: 95.0
Exam Two: 75.2
Exam Three: 88.4
Homework: 98.6
When I pass in student1.txt as the constructor parameter, examOne should become 95.0, examTwo 75.2, examThree 88.4, and homework 98.6.
Method:
Using calcGrade, determine the students total average grade as a double. You should use the variables examOne, examTwo, examThree, and homework. Since these are global object variables, they are accessible from the method without needing to be passed in.
Use the following to calculate the students grade
Exam One: 20% of grade
Exam Two: 20% of grade
Exam Three: 20% of grade
Homework: 40% of grade
Return a double representing their grade
THIS IS THE CURRENT CODE
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Student{
private double exam1Grade;
private double exam2Grade;
private double exam3Grade;
private double homeworkGrade;
public Student(String filename){
//implement the constructor here
}
public double getGrade(){
//implement the method getGrade
return 0.0;
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!