Question: Exception in thread main java.lang.Error: Unresolved compilation problem: at Driver.main(Driver.java:12) // How do I fix this code? import java.util.ArrayList; import java.util.Scanner; public class Monkey extends

Exception in thread "main" java.lang.Error: Unresolved compilation problem: at Driver.main(Driver.java:12) // How do I fix this code? import java.util.ArrayList; import java.util.Scanner; public class Monkey extends RescueAnimal { enum Species { MACAQUE, MARMOSET, CAPUCHIN, GUENON, SQUIRREL_MONKEY, SPIDER_MONKEY, TAMARIN } private float tailLength, height, bodyLength; private String breed; private Species species; public Monkey(String name, int age, String breed, Species species, float tailLength, float height, float bodyLength) { super(name, age); this.setBreed(breed); this.setSpecies(species); this.setTailLength(tailLength); this.setHeight(height); this.setBodyLength(bodyLength); } private void setSpecies(Species species2) { // TODO Auto-generated method stub } public static void intakeNewMonkey(Scanner scanner, ArrayList monkeyList) { String name, breed; int age; Species species = null; float tailLength, height, bodyLength; System.out.println("Enter the monkey's name:"); name = scanner.nextLine(); while (true) { System.out.println("Enter the monkey's species (choose from: MACAQUE, MARMOSET, CAPUCHIN, GUENON, SQUIRREL_MONKEY, SPIDER_MONKEY, TAMARIN):"); String input = scanner.nextLine().toUpperCase(); try { species = Species.valueOf(input); break; } catch (IllegalArgumentException e) { System.out.println("Invalid species. Please try again."); } } System.out.println("Enter the monkey's age:"); age = scanner.nextInt(); scanner.nextLine(); System.out.println("Enter the monkey's breed:"); breed = scanner.nextLine(); System.out.println("Enter the monkey's tail length:"); tailLength = scanner.nextFloat(); scanner.nextLine(); System.out.println("Enter the monkey's height:"); height = scanner.nextFloat(); scanner.nextLine(); System.out.println("Enter the monkey's body length:"); bodyLength = scanner.nextFloat(); scanner.nextLine(); Monkey newMonkey = new Monkey(name, age, breed, species, tailLength, height, bodyLength); monkeyList.add(newMonkey); System.out.println("New monkey added to the system."); } public static void printRescueAnimal2(ArrayList monkeyList) { System.out.println("List of rescue monkeys:"); for (Monkey monkey : monkeyList) { System.out.println("Name: " + monkey.getName()); System.out.println("Age: " + monkey.getAge()); System.out.println("Breed: " + monkey.getBreed()); System.out.println("Species: " + monkey.getSpecies1()); System.out.println("Tail length: " + monkey.getTailLength()); System.out.println("Height: " + monkey.getHeight()); System.out.println("Body length: " + monkey.getBodyLength()); System.out.println(); } } public float getTailLength() { return tailLength; } public void setTailLength(float tailLength) { this.tailLength = tailLength; } public float getHeight() { return height; } public void setHeight(float height) { this.height = height; } public float getBodyLength() { return bodyLength; } public void setBodyLength(float bodyLength) { this.bodyLength = bodyLength; } public String getBreed() { return breed; } public void setBreed(String breed) { this.breed = breed; } public Species getSpecies1() { return species; } public String getName() { // TODO Auto-generated method stub return null; } public String getSpecies() { // TODO Auto-generated method stub return null; } public String getLocation() { // TODO Auto-generated method stub return null; } public String getStatus() { // TODO Auto-generated method stub return null; } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!