Java 程序设计教程(第五版)EXAMPLESchap08源码

源代码在线查看: dictionary.java

软件大小: 8 K
上传用户: zhoulovely
关键词: EXAMPLESchap Java 08 程序设计
下载地址: 免注册下载 普通下载 VIP

相关代码

				//********************************************************************
				//  Dictionary.java       Author: Lewis/Loftus
				//
				//  Represents a dictionary, which is a book. Used to demonstrate
				//  inheritance.
				//********************************************************************
				
				public class Dictionary extends Book
				{
				   private int definitions = 52500;
				
				   //-----------------------------------------------------------------
				   //  Prints a message using both local and inherited values.
				   //-----------------------------------------------------------------
				   public double computeRatio ()
				   {
				      return definitions/pages;
				   }
				
				   //----------------------------------------------------------------
				   //  Definitions mutator.
				   //----------------------------------------------------------------
				   public void setDefinitions (int numDefinitions)
				   {
				      definitions = numDefinitions;
				   }
				
				   //----------------------------------------------------------------
				   //  Definitions accessor.
				   //----------------------------------------------------------------
				   public int getDefinitions ()
				   {
				      return definitions;
				   }
				}
							

相关资源