Question: In the Mouse program of Figures 6.4 and 6.5, what is the persistence of guss age variable? Figures 6.4 Figures 6.5 /**************** * Mouse.java *
In the Mouse program of Figures 6.4 and 6.5, what is the persistence of gus’s age variable?
Figures 6.4

Figures 6.5

/**************** * Mouse.java * Dean & Dean * * This class models a mouse for a growth simulation program. ****************** public class Mouse { *********************************************** private int age = 0; private double weight = 1.0; private double percent Growth Rate; //********************************* //*************** ****** public void grow() { // This method assigns the mouse's percent growth rate. //************* this. percent Growth Rate = percent Growth Rate; ------ } // end set Percent Growth Rate public void setPercentGrowth Rate (double percentGrowth Rate) { instance variable declarations public void display() { ******* // age of mouse in days // mouse weight in grams // increase per day ******** *********************** } // end display } // end class Mouse this.age, this.weight); **** // This method simulates one day of growth for the mouse. this.weight + (.01 * this.percentGrowth Rate this.weight); this.age++; 3 // end grow **********/ ******** // This method prints the mouse's age and weight. System.out.printf("Age - %d, weight = %.3f ", parameter To access instance variables, use this dot. ************* *********** method body
Step by Step Solution
3.46 Rating (153 Votes )
There are 3 Steps involved in it
Guss age is an instance variable Instance vari... View full answer
Get step-by-step solutions from verified subject matter experts
