Please remember that homework must be handed in on time. No late homework will be accepted.
public int getMinimumMileage() { }
public boolean isAlphabetical() { if (numParked == 0) return true; for (int i = 0; i < ___________________; i++) { // Compare car i with car i+1 in parking lot: if (_________________________________________) { return false; // not in alphabetical order, return false } } return true; }
public void reverse() { }
public ParkingLot buildNewLot(String carMake) { // Creates and returns a new parking lot that contains // references to the cars in this parking lot (in the // same relative order) that have a make that matches // the car make given in the parameter. ParkingLot newLot = new ParkingLot(); for (int i = 0; i < numParked; i++) { Car currentCar = parkingSpace[i]; if (currentCar.getMake().equals(carMake)) insertAtEnd(currentCar); } return newLot; }
This method contains a logical error, however. Carefully explain what happens specifically if this method is called and at least one car in the current parking lot matches the make given in the parameter.
int[][] t = new int[7][24];
Each row represents one day (row 0 is Sunday, row 1 is Monday, etc.), and each column represents one hour (column 0 is 12AM, column 1 is 1AM, etc.). You may assume that the array is completely initialized with temperature readings.
For example, the first matrix below is symmetric while the second and third matrices are not:
1 4 3 9 2 4 5 7 3 1 10 4 5 7 12 4 5 7 1 1 9 6 3 7 8 0 5 7 1 6 10 8 4 9 12 0 2 Symmetric Not Symmetric Not Symmetric (not square) (m[2][1] ≠ m[1][2])
Complete the method isSymmetric that takes a two-dimensional array m of integers and returns true if the array m is symmetric and false otherwise. Complete the method so it performs only those computations that are absolutely necessary to determine the answer.
public static boolean isSymmetric(int[][] m) { int numRows = ___________________________; int numColumns = ___________________________; if (numRows != numColumns) return false; for (int row = ______; row < _______________; row++) { for (int col = _______; col < ________________; col++) { if (_________________________________________) return false; } } return true; }
NOTE: Check your answer by tracing your method for the symmetric matrix given above. Include this with your answer.