Question: Fix the following class to have appropriate access modifiers. Add default and non-default constructors ( 6 points ) Add any missing modifiers and Change any
Fix the following class to have appropriate access modifiers.
- Add default and non-default constructors ( 6 points )
- Add any missing modifiers and
- Change any incorrect access modifiers ( 13 points )
- Include a comment with your name and explain your changes ( 1 point )
class AccessModifiers { int age; protected double gpa; String name; String studentID; protected int getAge() { return age; } protected void setAge(int age) { this.age = age; } private double getGpa() { return gpa; } private void setGpa(double gpa) { this.gpa = gpa; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getStudentID() { return studentID; } @Override public String toString() { return "AccessModifiers [age=" + age + ", gpa=" + gpa + ", name=" + name + ", studentID=" + studentID + "]"; } }
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
