Question: Implement an application that will read data from an input file, interpret the data, and generate the output to the screen. - The application will

Implement an application that will read data from an input file, interpret the data, and generate the output to the screen.

- The application will have two classes, Rectangle and Lab2ADriver.

- Name your Eclipse project, Lab2A.

Implement the Rectangle class with the following description.

Rectangle

Data fields

-numRows: int

-numCols: int

-filled: Boolean

Store the number of rows in the Rectangle

Store the number of columns in the Rectangle

Will define either a filled or unfilled rectangle

True = filled, False = unfilled

Methods

+Rectangle()

+Rectangle(int, int)

+Getter methods

+Setters methods

+toString(): String

Initialize rows, columns to 1 and filled to false

Input values will set the numRows & numCols

Create and return a String for output

For example when

numCols = 4, numRows = 3, filled = false

The method creates and returns the string

#### # # ####

- Implement Lab2ADriver class with the following description. The Lab2ADriver class:

- Contains the main method.

- Contains an object array that will hold Rectangle objects.

- Reads in the text file rectangleData.txt that starts with the total number of lines in the file followed by data for constructing a Rectangle object.

- With the data read from the file, construct Rectangle object, and store it to the object array.

- Prints Rectangle objects to the screen accordingly.

For example

6 <= Number of lines in an input file

6 3 filled

3 6 unfilled

4 4 filled

6 6 unfilled

9 4 filled

4 8 unfilled

rectangleData.txt

Output

###

###

###

###

###

###

######

# #

######

####

####

####

####

######

# #

# #

# #

# #

######

####

####

####

####

####

####

####

####

####

########

# #

# #

########

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!