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

I need some help, would you please use the java to write the code for me Objecti

ID: 3705876 • Letter: I

Question

I need some help, would you please use the java to write the code for me

Objective:

Write two classes:  One class draws a square, and an exception that occurs when the user puts in an invalid dimension.

First download the driver and put it in your project

DO NOT ALTER THE DRIVER!

Write a class file called DimensionException that inherits from Exception

Create the following constructors

Default – calls the parent’s constructor and pass a message that it is an invalid dimension

A constructor that takes one string parameters that is passed to the parent’s constructor

Write a class file called Square that DOES NOT HAVE  a main method

An attribute of this class is

Length – corresponding to the length of each side

Create the following constructors

Default – creates a 1x1 square (or a single star)

One that has a integer parameter that corresponds to its length and width

Accessors and Mutators for each variable

MAKE SURE THE MUTATORS CHECK FOR VALID VALUES!

If the dimension is set improperly throw the DimensionException

Create the following Methods

draw – this method will draw a square of asterisks (*) by the given dimensions.  

getArea – returns the area of the square

getPerimeter – returns the perimeter of the square

======================================================================

the driver:

Explanation / Answer

Hi Dear,

Please find my implementation.

Welcome to the easy square program
Enter the length of the side of a square or enter QUIT to quit
f
For input string: "f"
Enter the length of the side of a square or enter QUIT to quit
6
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
The area is 36
The perimeter is 24
Enter the length of the side of a square or enter QUIT to quit
8
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
* * * * * * * *
The area is 64
The perimeter is 32
Enter the length of the side of a square or enter QUIT to quit
quit

Process finished with exit code 0