Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Pesron class public abstract class Person { private String name; private String address; private short age; // constructor that takes only two paras public Person(String

Pesron class public abstract class Person { private String name; private String address; private short age; // constructor that takes only two paras public Person(String name, short age) { super(); this.name = name; this.age = age; } public String getName() { return name; } public void setName(String name) { this.name = name; } public abstract String getAddress() ; public abstract void setAddress(String address); public short getAge() { return age; } public void setAge(short age) { this.age = age; } }

public class DriverClass {
public static void main(String[] args) {
// ToDo 5: Fix the error
// ToDo 6: Fix the constructor of Student class
// ToDo 7: Add a toString method for Student class
Student std1= new Student("James", 20);
// ToDo 8: Set the gpa of the student using the scanner and user
// input and then print the output.
System.out.println(std1);
// ToDo 9: add comments and explain your code
// ToDo 10: submit using a pull request.
}
}
public class Student {
// ToDo 1: Make this class a child of Person
// ToDo 2: Fix the resulting errors
// ToDo 3: Add a field for GPA and create setter and getter
// ToDo 4: Add comments to your code
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions