Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public class Undergraduate extends Student { private int level; //1 for freshman, 2 for sophomore, //3 for junior, or 4 for senior. public Undergraduate( )

public class Undergraduate extends Student { private int level; //1 for freshman, 2 for sophomore, //3 for junior, or 4 for senior. public Undergraduate( ) { super( ); level = 1; } public Undergraduate(String initialName, int initialStudentNumber, int initialLevel) { super(initialName, initialStudentNumber); setLevel(initialLevel); //Checks 1 <= initialLevel <= 4 } public void reset(String newName, int newStudentNumber, int newLevel) { reset(newName, newStudentNumber); //Students reset setLevel(newLevel); //Checks 1 <= newLevel <= 4 } public int getLevel( ) { return level; } public void setLevel(int newLevel) { if ((1 <= newLevel) && (newLevel <= 4)) level = newLevel; else { System.out.println("Illegal level!"); System.exit(0); } } public void writeOutput( ) { super.writeOutput( ); System.out.println("Student Level: " + level); } public boolean equals(Undergraduate otherUndergraduate) { return equals((Student)otherUndergraduate) && (this.level == otherUndergraduate.level); } /* // Alternate version public boolean equals(Undergraduate otherUndergraduate) { return super.equals(otherUndergraduate) && (this.level == otherUndergraduate.level); } */ }

In class Undergraduate how many statements invoke the base's methods (do not count comstructors)? Explain

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_2

Step: 3

blur-text-image_3

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

Creating A Database In Filemaker Pro Visual QuickProject Guide

Authors: Steven A. Schwartz

1st Edition

0321321219, 978-0321321213

More Books

Students also viewed these Databases questions