Java OOP GUIDE / WORK BOTTLE CLASS 2 Topics
TASK –
PART 1 – BOTTLE CLASS SETUP If
you did not do the first Bottle Class work, go to the Bottle Class work
solutions and copy and paste the Bottle class into your IDE. Take
a few minutes to look over the code. TASK –
PART 2 – BOTTLE ARRAY Inside
the BottleArray class create a main function. Inside main, create a
Bottle array that contains five Bottle objects. Without
using a for loop, create an object for each element in the array making sure
each bottle has a different colour and different
volume. TASK –
PART 3 – DISPLAY THE ARRAY Use
a for loop to display each element of the array to screen (making use of the
Bottle class’ toString method). TASK –
PART 4 – DISPLAY THE ARRAY Write
the function called biggestBottleColour() that gets a Bottle[] and returns the colour of the biggest bottle (based on maxVolume) in the array. Test
your function. |
|