Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

25. (coding) Write Java to complete the following tasks. Please itemize your ans

ID: 3720635 • Letter: 2

Question

25. (coding) Write Java to complete the following tasks. Please itemize your answers. Any syntax error is penalized. #1 Write an interface called Grade!nterface that has a method called getGpa that returns a gpa #2. write a class called Student that will implements Grade Interface #3. In the Student class, add a data called myGpa #4. In the Student class, add a constructor that accepts gpa a s a parameter that will be used to initialize myGpa. #5. In the Student class, implement the getGpa method that will returns myGpa #6, write a class called Sophomore that will be the subclass of the Student class. #7. In the Sophomore class, add a constructor that will accept a gpa as a parameter that will be used to initialize its myGpa that is located in its superclass. z Started Save All Responses Go to Submit Quiz ELITEONE

Explanation / Answer

Below is your code. I am not adding any main method, as it is not asked in question. Let me know if you have any issues in comments

GradeInterface.java

//Interface declaration

public interface GradeInterface {

//declaration of abstract method returning gpa

public abstract double getGpa();

}

Student.java

//Student class declaration implementing GradeInterface

public class Student implements GradeInterface{

//instance variable

private double myGpa;

//constructor

public Student(double gpa) {

myGpa = gpa;

}

//method returning gpa

public double getGpa() {

return myGpa;

}

}

Sophomore.java

//Sophomore class - child class of student

public class Sophomore extends Student {

//constructor

public Sophomore(double gpa) {

super(gpa);

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote