Question
USING JAVA. For part 2 instead of of reading the txt file can you help me put it into arrays. Part 3 i need help
USING JAVA. For part 2 instead of of reading the txt file can you help me put it into arrays. Part 3 i need help completing it too as well.
Here is my code. for Part 1
import java.util.Scanner;
public class ParkManager {
public static void main (String[] args) throws java.lang.Exception
{
String characterLocations[][] = {{"Mickey Mouse", "Main Street USA"}, {"Minnie Mouse", "Toon Town"}, {"Goofy", "Frontier Land"}, {"Pluto", "Tomorrowland"}, {"Belle","FantasyLand"}, {"Jasmine", "Adventureland"}};
for(int i=0;i
}
Scanner sc = new Scanner(System.in);
System.out.print("Enter the Character to find the location:");
String character = sc.nextLine();
findLocation(characterLocations, character);
}
public static void findLocation(String[][] characterLocations , String character){
for(int i=0;i
if(characterLocations[i][0].equalsIgnoreCase(character)){
System.out.println(characterLocations[i][1]);
return;
}
}
}
}
Here are the menuItems.txt and menuPrices.txt files in the table below.
menuItems.txt | menuPrices.txt |
Churros | 5 |
Ice Cream | 4 |
Hamburger | 9 |
Cheeseburger | 10 |
Turkey Leg | 13 |
Corn Dog | 7 |
Pizza | 9 |
Funnel Cake | 6 |
Soda | 5 |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started