TextBook - // Returns whether the answers are provided for...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // TextBook.java Authors: Lewis and Loftus // // Solution to Programming Project 7.3 //******************************************************************** public class TextBook extends Book { protected boolean answers; //----------------------------------------------------------------- // Sets up this textbook with the specified information. //----------------------------------------------------------------- public TextBook (String thisTitle, String isbnNum, String auth, boolean ans) { super (thisTitle, isbnNum, auth); answers = ans; } //----------------------------------------------------------------- // Sets whether the answers are provided for this textbook. //----------------------------------------------------------------- public void setAnswers (boolean ans) { answers = ans; } //-----------------------------------------------------------------
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: // Returns whether the answers are provided for this textbook. //-----------------------------------------------------------------public boolean getAnswers() { return answers; } //-----------------------------------------------------------------// Returns a description of this textbook as a string. //-----------------------------------------------------------------public String toString () { String result = super.toString(); if (!answers) result += "no "; result += "answers given"; return result; } //-----------------------------------------------------------------// Prints a message appropriate for this textbook. //-----------------------------------------------------------------public void content() { super.content(); System.out.println ("Answers provided: " + answers); } }...
View Full Document

Ask a homework question - tutors are online