Details on lions Animal
/*
- To change this license header, choose License Headers in Project Properties.
- To change this template file, choose Tools | Templates
- and open the template in the editor.
*/
package zookeepermonitoringsystem;
import java.util.Scanner;
import javax.swing.JOptionPane;
import java.io.;
import java.util.;
/**
*
- @author Louis
*/
public class ZooKeeperMonitoringSystem { /**- @param args the command line arguments
- @throws java.io.IOException
*/
public static void main(String args[]) throws IOException {
System.out.println(“Welcome to the San Diego Zoo Animal “
+ “Monitoring System”);
System.out.println(“Please choose one of the following options: “);
System.out.println(“1. Monitor an Animal”);
System.out.println(“2. Monitor a Habitat”);
System.out.println(“3. Exit”); while (true) {
Scanner mainMenuOptions = new Scanner(System.in);
int option = mainMenuOptions.nextInt();switch (option) { case 1: System.out.println("Select one animal for monitoring: "); System.out.println("1. Lion"); System.out.println("2. Tiger"); System.out.println("3. Bear"); System.out.println("4. Giraffe"); System.out.println("5. Return to main menu"); animalOptions(); break;case 2: System.out.println("Select one habitat to monitor: "); System.out.println("1. Penguin Habitat"); System.out.println("2. Bird House"); System.out.println("3. Aquarium"); System.out.println("4. Return to main menu"); habitatOptions(); break; case 3: System.out.println("Exit"); break; default: System.out.println("Please select an option from " + "the main menu.");}
}
}
File zooAnimals = new File(“animalsNew.txt”);
Scanner lionFile = new Scanner(zooAnimals);while(lionFile.hasNext()) { String lionInfo = lionFile.nextLine(); System.out.println(lionInfo); }
} public static void readHabitatFile() {
File file = new File(“habitatNew.txt”);try { Scanner input = new Scanner(file); String habitatName = input.nextLine();System.out.printf("Request: %s", habitatName);} catch (FileNotFoundException ex) { System.out.printf("ERROR: %s\n", ex); }
} public static void animalOptions() throws FileNotFoundException {
Scanner userChoiceAnimal = new Scanner(System.in);
int option = userChoiceAnimal.nextInt();switch (option) { case 1: readAnimalFile(); break; case 2: System.out.println("Tigers"); break; }
} public static void habitatOptions() {
Scanner userChoiceHabitat = new Scanner(System.in);
int option = userChoiceHabitat.nextInt();switch (option) { case 1: readHabitatFile(); break; case 2: System.out.println("Birds"); break; case 3: System.out.println("Aquarium"); break; case 4: System.out.println("Return to main menu"); break; case 5: System.out.println("Exit the program"); break; }
}
}
"Looking for a Similar Assignment? Order now and Get 10% Discount! Use Code "Newclient"
