Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello! I attached my code and the error that I am getting when I try to run it. Can you please help me fix it.
Hello! I attached my code and the error that I am getting when I try to run it. Can you please help me fix it. I have no idea what the error means. it is in java. I really appreciate your help.
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 4 out of bounds for length 4 at ParkingLot.populateFromFile(ParkingLot.java:234) at ParkingLot.(ParkingLot.java:66) at ParkingLot.main(ParkingLot.java:330) mport java. util. Scanner; * @author Mehrdad Sabetzadeh, University of 0ttawa */ ublic class ParkingLot \{ / * The delimiter that separates values */ private static final String SEPARATOR = ","; /** * The delimiter that separates the parking lot design section from the parked * car data section */ private static final String SECTIONER =" "\#\#"'; /** * Instance variable for storing the number of rows in a parking lot */ private int numRows; /** * Instance variable for storing the number of spaces per row in a parking lot */ private int numSpotsPerRow; /** * Instance variable (two-dimensional array) for storing the lot design */ private CarType [] [] lotDesign; /** * Instance variable (two-dimensional array) for storing occupancy information * for the spots in the lot */ private Car[] [] occupancy; /** * Constructs a parking lot by loading a file * @param strFilename is the name of the file */ public ParkingLot(String strFilename) throws Exception \{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