Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me complete the TODO's in this code in Java! import java.util.Scanner: public class Assignment4Skeleton t static boolean [ exploredWorld; public static void main(String

Please help me complete the TODO's in this code in Java!

image text in transcribedimage text in transcribedimage text in transcribed

import java.util.Scanner: public class Assignment4Skeleton t static boolean [ exploredWorld; public static void main(String [] args) Scanner scnew Scanner(System.in); System.out.print ln("Enter the dimensions of your jungle!"; System.out.print("Enter length: "); int length = sc.nextInt(); System.out.print("Enter width:"; int widthsc.nextInt); *Declare and initialize arrays and generate the world starting from 0, Note: Don't forget to initialize exploredworld Note: Make sure to loop through the String array animalLocations and initialize all / While choice is not exit: 0 Process the user choice Note: Be sure to include input validation for choice /*TODO: Cmplete makeworld * This methods basically sets up the visible world. Assigning" *to unexplored areas and "0" to explored areas At the end of the method and after assigning new Strings using loops and if statements, * it returns the 2D String array world public static String[] [] makeWorld(String [] [] world, int posX, int posY) /TODO: Complete printMainMenu 1. Insert an animal into the world 2. Remove an animal from the world public static void printManMenu() { /TODO: Complete printMoveMenu Enter your choice: public static void printMoveMenu) TODO: Complete insertAnimal to World * Prompts the user to enter the x and y coordinate as well as their desired animal name and inserts it to the world in the location [x,ylas Long as: - The x and y coordinates are in the world's boundaries - The area [x,y] is not occupied by another animal If the conditions are not met prompt the user to enter the coordinates as well as the animal name again until the conditions above are met public static void insertAnimalTonorld(String animalLocations) TODO: Complete removeAnimaLFromWorld Prompts the user to enter the x and y coordinate and removes the animal from the world in the location [x,yl as long as: If the conditions are not met prompt the user to enter the coordinates until the conditions above are met Hint: To remove the animal you can just set the String at [x,yl to public static void removeAnimaLFromWorld(String animalLocations) ( -The x and y coordinates are in the world's boundaries - The area [x,yl is not empty (contains an animal) *TODO: Complete isEmptyBlock * Returns false if the array has an animal at [x,yl and true if [x,yl is empty public static boolean isEmptyBlock(String world, int x, int y) f /*TOD0: Complete update0bservedAnimals * adds animal into the observedAnimals array into the first occurrence of an empty String and returns the observedAnimals array public static Stringl update0bservdAnimals(Stringtl observedAnimals, String anima) * Prints the 2D array world *Note: Nothing to do here, it's done for you! public static void printWorld(String[l world) for (int 1-0; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions

Question

Knowledge of project management (PMI) teachings

Answered: 1 week ago

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago