Session 20
Source Code
import java.util.*;
public class Week20 {
public static void main(String[] args) {
String myName = ""; // add your name
System.out.println("Week 20" + " - " + myName);
// Menu
System.out.println("Menu");
System.out.println("E1 - Example 1");
System.out.println("Q - Quit");
// setup Scanner
Scanner in = new Scanner(System.in);
System.out.print("Choice: ");
String choice = in.nextLine();
// switch choices
switch (choice) {
case "E1":
System.out.println("Example 1");
example1();
break;
case "E2":
System.out.println("Example 2");
example2();
break;
case "E3":
System.out.println("Example 3");
example3();
break;
case "E4":
System.out.println("Example 4");
example4();
break;
case "Q":
System.out.println("Quitting..!");
break;
}
}
// example1 method
public static void example1() {
// Create Objects
// Create an array of Felines
// populate the array with Cat and Tiger objects
// loop through array and call method
// instanceOf Examples
// is catty a Feline?
// is tigris a Feline?
// is felix a Cat?
}
// example2 method
public static void example2() {
// create a new Zoo
// Adding different animals to the zoo
// Displaying all animals in the zoo
}
// example3 method
public static void example3() {
// Create Object
}
// example4 method
public static void example4() {
// Create Object
}
}
Feline.java
Tiger.java
Cat.java
Zoo.java
Professions.java
MainCharacter.java
SquareDemo.java
Last updated
Was this helpful?