Exercises Exercises IIIB IVB
1
Define enum a (an enumerated type) to represent the days of the week. Create two
dadBirthDayDoW name data and the momBirthDayDoW appropriate type. Click
input value of the two figures.
2 pets
Create the array of reference variables of type Animal.
Animal is an interface where you have to define methods
void eat (Food f) and getFirstName String () which returns the name of an animal, double getWeight () and double getWithers (). Weight
ing. Withers ing weight. withers.
Define two classes that implement the Animal adding encapsulated instance variables required.
Provide a constructor that takes classes initializes the name of the animal. Popular
pets with just two classes of objects defined.
name is generated randomly as an integer and use it as a constructor argument Once converted to a string. 3
using the generalized cross for pets to assign the elements of an array of String to define / create the names of the animals in pets. 4
define some subclasses of Food. Then cross
pets pets so the animals eat the food. 5
Define a method in a test class that returns the ratio between the weight and height at the withers of an animal.
Do homework notebook.
And on the forum.
0 comments:
Post a Comment