Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The superclass Student contains: a constructor that accepts a String corresponding to the name of the school the student attends a toString method that returns

The superclass Student contains: a constructor that accepts a String corresponding to the name of the school the student attends a toString method that returns 'student at X' where X is the name of the school the student attends. Write a class definition for the subclass HighSchoolStudent containing: a constructor accepting a String which is used as a parameter to the superclass constructor a toString method that returns 'high school student at X'. This method must use the toString method of its superclass.

I wrote this:

public class HighSchoolStudent extends Student{

public HighSchoolStudent(String school){

super(school);

}

public String toString(){

return "high school" + super.toString();

}

}

but it keeps telling me I'm not returning the proper string from toString please help :)

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

Recommended Textbook for

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions