Session 5
OldMacDonaldv1.java
public class OldMacDonaldv1 {
public static void main(String args[]) {
System.out.println("Old MacDonald had a farm.");
System.out.println("E-I-E-I-O");
System.out.println("And on this farm, they had a cow.");
System.out.println("E-I-E-I-O");
System.out.println("With a moo moo here and a moo moo there");
System.out.println("Here a moo, there a moo, everywhere a moo moo");
System.out.println("Old MacDonald had a farm");
System.out.println("E-I-E-I-O");
}
}OldMacDonaldv2.java
public class OldMacDonaldv2 {
public static void intro() {
System.out.println("Old MacDonald had a farm");
chorus();
}
public static void chorus() {
System.out.println("E-I-E-I-O");
}
public static void main(String[] args) {
intro();
System.out.println("And on that farm they had a cow.");
chorus();
System.out.println("With a moo moo here and a moo moo there");
System.out.println("Here a moo, there a moo, everywhere a moo moo");
// TODO:
// 1. Call the method intro()
// 2. Print out the line "And on that farm..."
// with a duck or another animal
// 3. Call the method chorus
// 4. Print out the lines with the appropriate animal sounds
// 5. Call the method intro again
}
}OldMacDonaldv3.java
OldMacDonaldv4.java
AntsSong.java
PoemLab.java
Last updated
Was this helpful?