Details on lions Details on tigers Details on bears Details on giraffes Animal – Lion Name: Leo Age: 5
package zoomonitoring;
import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;
/**
*
- @author Sarah
*/
public class ZooMonitoring { public static void main(String[] args) throws IOException {
//scanner reads input from user
Scanner sc=new Scanner (System.in);
//Buffered reader to read from animals file
BufferedReader brA=new BufferedReader(new FileReader(“Files/animals.txt”));//organized to call from one file named Files
//Buffered reader to read from habitats file
BufferedReader brH=new BufferedReader (new FileReader(“Files/habitats.txt”));int userInput = 0;
//loop until user inputs option 3 to exit
while (userInput !=3){
//reading from animals and habitats files
brA=new BufferedReader(new FileReader(“animals.txt”));
brH=new BufferedReader(new FileReader(“habitats.txt”));//prompting user System.out.println("What would you like to monitor? "); System.out.println("Enter 1 to monitor Animals "); System.out.println("Enter 2 to monitor Habitats "); System.out.println("Enter 3 to Exit"); userInput=sc.nextInt(); String[] details=null; if(userInput==1){ String line;System.out.println("List of Animals "); int op=0; int blankLine=0; int separateSection=0; int index=-1; while((line=brA.readLine())!=null) { separateSection=0; if(line.equals("")) { blankLine++; if(blankLine==1) { details=new String[op]; } separateSection=1; index++; } } }} }
}
}
"Looking for a Similar Assignment? Order now and Get 10% Discount! Use Code "Newclient"
