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
|
rectangleData.txt
Output
###
###
###
###
###
###
######
# #
######
####
####
####
####
######
# #
# #
# #
# #
######
####
####
####
####
####
####
####
####
####
########
# #
# #
########
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started