Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JAVA CODE Need Java Code for Pseudocode. PROMPT USER: What would you like to mon

ID: 3822305 • Letter: J

Question

JAVA CODE

Need Java Code for Pseudocode.

PROMPT USER: What would you like to monitor?

INPUT: Animal

INPUT: Habitat

WHILE Monitor=Animal Select Animal lions tigers bears giraffes

IF Animal= Lion

OUTPUT= Name, Age, Health Concerns

IF Animal= Tigers

OUTPUT= Name, Age, Health Concerns

IF Animal= bears

OUTPUT= Name, Age, Health Concerns

IF Animal= giraffes

OUTPUT= Name, Age, Health Concerns

WHILE Monitor=Habitat Select Habitat Penguin Bird Aquarium

IF Habitat=Penguin

OUTPUT= Temperature, Food Source, Cleanliness

IF Habitat=Bird

OUTPUT= Temperature, Food Source, Cleanliness

IF Habitat=Aquarium

OUTPUT= Temperature, Food Source, Cleanliness

ELSE = Error! Please Select from Choices. END Need to include txt file as well

ANIMALS.TXT

Details on lions Details on tigers Details on bears Details on giraffes

Animal - Lion Name: Leo Age: 5 *****Health concerns: Cut on left front paw Feeding schedule: Twice daily

Animal - Tiger Name: Maj Age: 15 Health concerns: None Feeding schedule: 3x daily Animal -

Bear Name: Baloo Age: 1 Health concerns: None *****Feeding schedule: None on record Animal -

Giraffe Name: Spots Age: 12 Health concerns: None Feeding schedule: Grazing

HABITATS.TXT

Details on penguin habitat Details on bird house Details on aquarium

Habitat - Penguin Temperature: Freezing *****Food source: Fish in water running low Cleanliness: Passed

Habitat - Bird Temperature: Moderate Food source: Natural from environment Cleanliness: Passed

Habitat - Aquarium Temperature: Varies with output temperature Food source: Added daily *****Cleanliness: Needs cleaning from algae

Explanation / Answer

//include library files.
import java.util.*;
import java.lang.*;
import java.io.*;

//Name of the class main class
class ShowInfo
{
   public static void main (String[] args) throws java.lang.Exception
   {
   //declaring scanner variable/reference, of the scanner class so as to take input from the user.
       Scanner scanner = new Scanner( System.in );
      
       System.out.println("What would you like to monitor ?");
System.out.println("Press 1 for Animal");
System.out.println("Press 2 for Habitat");
System.out.println("Enter your Choice");


//initializing variables.
int n=0,m=0;
// Here's the syntax for taking input from user
n= Integer.parseInt(scanner.nextLine());

//Check input from user
if(n==1)
{

//if input =1 , i.e user has selected animals , then display list of it.
System.out.println("Press 1 for Lions");
System.out.println("Press 2 for Tigers");
System.out.println("Press 3 for Bears");
System.out.println("Press 4 for Giraffes");
  
System.out.println("Enter your Choice");

//take input from user
m= Integer.parseInt(scanner.nextLine());

//check for the input
if(m==1)
{
System.out.println("Name: Leo Age: 5 Health concerns: Cut on left front paw Feeding schedule: Twice daily");
}
else if(m==2)
{
System.out.println("Name: Maj Age: 15 Health concerns: None Feeding schedule: 3x daily");
}
else if(m==3)
{
System.out.println("Name: Baloo Age: 1 Health concerns: None Feeding schedule: None on record");
}
else if(m==4)
{
System.out.println("Name: Spots Age: 12 Health concerns: None Feeding schedule: Grazing");
}

//if user enter incorrect option
else
{
System.out.println("Enter Correct Choice");
}
}

else if(n==2)
{

//if n=2, then display lists of habitat

System.out.println("Press 1 for Penguin");
System.out.println("Press 2 for Bird");
System.out.println("Press 3 for Aquarium");
System.out.println("Enter your Choice");

//take input from user
m= Integer.parseInt(scanner.nextLine());

//Check the input
if(m==1)
{
System.out.println("Temperature: Freezing Food source: Fish in water running low Cleanliness: Passed");
}
else if(m==2)
{
System.out.println("Temperature: Moderate Food source: Natural from environment Cleanliness: Passed");
}
else if(m==3)
{
System.out.println("Temperature: Varies with output temperature Food source: Added daily Cleanliness: Needs cleaning from algae");
}
else
{

//If user enter incorrect option
System.out.println("Enter Correct Choice");
}
  
}
else
{
System.out.println("Enter Correct No. ");
}
   }
}