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 rectangles.txt that holds data for constructing several
Rectangle objects.
o A sample rectangles.txt 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
+Rectangle(int, 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 =3, cols =4, and filled = false,
the method creates and returns the string
####
# #
####
CS161 Introduction to Computer Science II
RectanGraphic Example Data and Output
rectangles.txt: Output
###
###
###
###
###
###
######
# #
######
####
####
####
####
######
# #
# #
# #
# #
######
####
####
####
####
####
####
####
####
####
########
# #
# #
########
#########
#########
#########
#########
#########
#########
#########
#########
#########
###########
# #
###########
63 filled
36 unfilled
44 filled
66 unfilled
94 filled
48 unfilled
99 filled
311 unfilled
CS161 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 madlib-result.txt.
o Each line should be no more than 70 characters (.length() of the line String)
Print View your Mad Lib in madlib-result.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 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 Programming Questions!