I. Semester Review

  • Classes Review
  • Gnome A Gnome has a double precision height in meters and an integer weight in kilograms. When you make a new Gnome, if you do not specify the weight it is assumed to be 10kg. Gnome a = new Gnome(0.37, 4); // 0.37m, 4kg Gnome b = new Gnome(0.61); // 0.61m, 10kg The Gnome class should have the following methods: public void grow(): Increase the height by 0.1m. public void eat(): A Gnome gains 1kg every 3 times it eats.