Java, Java, Java 3E

Chapter 3: Methods: Communicating with Objects

Ch 3 Lab: Old MacDonald

Click Here to Read the Lab Write-up

Brief description

This lab emphasizes the writing and use of methods and parameters to pass information to and from an object. In this case, the OldMacDonald class contains methods that sing at least three verses of "Old MacDonald Had a Farm."It uses a command line user interface.

The objectives of this lab are:

The output from your program should be something like:

Old MacDonald had a farm
E I E I O
And on his farm he had a duck
E I E I O
With a quack quack here
And a quack quack there
Here a quack, there a quack
Everywhere a quack quack.
Old MacDonald had a farm
E I E I O

Old MacDonald had a farm
E I E I O
And on his farm he had a pig
E I E I O
With a oink oink here
And a oink oink there
Here a oink, there a oink
Everywhere a oink oink.
Old MacDonald had a farm
E I E I O

Old MacDonald had a farm
E I E I O
And on his farm he had a dog
E I E I O
With a arf arf here
And a arf arf there
Here a arf, there a arf
Everywhere a arf arf.
Old MacDonald had a farm
E I E I O