Rhino_Solutions - public class Rhino { /* Name of Rhino */...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 public class Rhino { /** Name of Rhino */ private String name /** Gender of Rhino, 'M' for male and'F' for female */ private char gender /** Month of birth of Rhino */ private int MOB /** Year of birth of Rhino */ private int YOB /** Tag number of Rhino or -1 if Rhino is not tagged */ private int tag=-1 /** Name of father of Rhino */ private Rhino father /** Name of mother of Rhino */ private Rhino mother /** Number of children Rhino has */ private int numberOfChildren /** Constructor: a new Rhino. Parameters are, in order, * the name of the rhino, the month and year of birth, and its gender. * The new rhino is not tagged, its parents are not known, and gender is 'F' or 'M'. * It has no children. */ public Rhino(String n, int m, int y, char g) { name= n MOB= m YOB= y gender= g } /** = the name of the Rhino as a string */ public String getName() { return name } /** = the gender of the Rhino ('M' formale, 'F'for female) */ public char getGender() { return gender } /** = the month the Rhino was born in the range 1. ..12 as an int */ public int getMOB() { return MOB }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This homework help was uploaded on 02/20/2009 for the course CS 100 taught by Professor Fan/vanloan during the Spring '07 term at Cornell University (Engineering School).

Page1 / 3

Rhino_Solutions - public class Rhino { /* Name of Rhino */...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online