Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JAVA ----------------------------------- Exceptions to Create (Default message s

ID: 3704226 • Letter: J

Question

JAVA

-----------------------------------

Exceptions to Create (Default message should include information relating to the exception):

IllegallyParkedException

NegativeValueException

NotParkableException

LotFullException

VehicleMissingException

ParkingSpaceOccupiedException

InvalidColorException
InvalidBrandException

----------------------------------------------

UML Documents Required:

UML Hierarchy Diagram

UML Class Diagrams for each Class (Auto, Bicycle, Brand, Color, Parkable, ParkingLot, ParkingSpace, ValidParkingObject, Vehicle)

--------------------------------------------

Grading Breakdown:

Each Exception: 5 points each (40 points total)

UML Hierarchy Diagram (15 points)

UML Class Diagrams 5 points each (45 points total)

Auto.java

Explanation / Answer

Solution:

The below data illustrates with respect to the given data;

//IllegallyParkedException class

class IllegallyParkedException extends Exception {

   IllegallyParkedException(){

       System.out.println("The vehicle is illegally parked");

   }

}

//NegativeValueException class

class NegativeValueException extends Exception {

   NegativeValueException(){

       System.out.println("Negative value found");

   }

}

//NotParkableException class

class NotParkableException extends Exception {

   NotParkableException(){

       System.out.println("Vehicle not parkable!");

   }

}

//LotFullException class

class LotFullException extends Exception {

   LotFullException(){

       System.out.println("Unable to park vehicle! Lot full");

   }

}

//VehicleMissingException class

class VehicleMissingException extends Exception {

   VehicleMissingException(){

       System.out.println("Vehicle missing or not found!");

   }

}

//ParkingSpaceOccupiedException class

class ParkingSpaceOccupiedException extends Exception {

   ParkingSpaceOccupiedException(){

       System.out.println("Unable to park! Parking space occupied");

   }

}

//InvalidColorException class

class InvalidColorException extends Exception {

   InvalidColorException(){

       System.out.println("Sorry!, the color is not valid");

   }

}

//InvalidBrandException class

class InvalidBrandException extends Exception {

   InvalidBrandException(){

       System.out.println("Sorry! the brand is not valid");

   }

}