FootballStats - // Update the number of yards gained.

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

View Full Document Right Arrow Icon
//******************************************************************** // FootballStats.java Author: Lewis and Loftus // // Solution to Programming Project 7.4 //******************************************************************** public class FootballStats extends PlayerStats { protected int yards; //----------------------------------------------------------------- // Sets up this football stat object with the specified info. //----------------------------------------------------------------- public FootballStats (String player, String team) { super (player, team); yards = 0; } //----------------------------------------------------------------- // Increase the score by 6. //----------------------------------------------------------------- public void score() { score += 6; } //-----------------------------------------------------------------
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: // Update the number of yards gained. //-----------------------------------------------------------------public void gainYards (int numYards) { yards += numYards; } //-----------------------------------------------------------------// Returns the current number of yards. //-----------------------------------------------------------------public int getYards() { return yards; } //-----------------------------------------------------------------// Returns a description of this stats object as a string. //-----------------------------------------------------------------public String toString() { String result = super.toString(); result += "\nYards: " + yards; return result; } }...
View Full Document

Ask a homework question - tutors are online