Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

More Books

Students also viewed these Databases questions

Question

4. Show the trainees how to do it again.

Answered: 1 week ago

Question

8. Praise the trainees for their success in learning the task.

Answered: 1 week ago