Question: Develop an application that will read data from an input file, interpret the data, and generate output to the console. Complete two classes, Rectangle and
Develop an application that will read data from an input file,
interpret the data, and generate output to the console.
Complete two classes, Rectangle and RectanGraphic.
Implement the Rectangle class according to the following UML description:
Implement the RectanGraphic class with the following features:
Create the main method.
Read from the text file rectanglestxt that holds data for constructing several
Rectangle objects.
o A sample rectanglestxt file is in the project root folder.
o Remember that the default relative filepath starting point is the project root folder
one folder above the src folder
Using the file data, create Rectangle objects and print their graphic representation to
the console.
o Reference the example output on the next page:
Rectangle
Data Fields
rows: int
cols: int
filled: Boolean
Number of rows
Number of columns
Defines either a filled or unfilled rectangle
True filled, False unfilled
Methods
Rectangleint int, boolean
toString: String
Constructor that will set rows, cols, and
filled
Create and return a String that graphically
represents the Rectangle
For example, when
rows cols and filled false,
the method creates and returns the string
####
# #
####
CS Introduction to Computer Science II
RectanGraphic Example Data and Output
rectangles.txt: Output
###
###
###
###
###
###
######
# #
######
####
####
####
####
######
# #
# #
# #
# #
######
####
####
####
####
####
####
####
####
####
########
# #
# #
########
#########
#########
#########
#########
#########
#########
#########
#########
#########
###########
# #
###########
filled
unfilled
filled
unfilled
filled
unfilled
filled
unfilled
CS Introduction to Computer Science II
MadLib
Develop an application that will read data from
two input files, interact with the user, and write results to an output file.
Complete the MadLib class in the madlib package.
A Mad Lib is a word game where players fill in blanks with various parts of speech like nouns,
verbs, and adjectives to create a humorous and often nonsensical story. This application allows
the user to create a random Mad Lib.
Complete the MadLib class main method with the following details:
Do not change any provided code. A TODO comment indicates where to begin adding
code.
o Observe the code to recognize: counting Mad Lib files, selecting a random Mad Lib
wordsFile and libFile, printing the names of the files, and creating the words array
Open the wordsFile, libFile, and user input for reading data.
Show the user each word prompt and store the users input into the words array.
Write completed lines to an output file madlibresult.txt
o Each line should be no more than characters length of the line String
Print View your Mad Lib in madlibresult.txt
Close all file streams
Hint: Scanner and PrintWriter will be useful for reading and writing Mad Lib data
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
