Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a Java program that prints rectangles of three different sizes to the screen, with a blank line between each rectangle. A 5 x 3 rectangle

a Java program that prints rectangles of three different sizes to the screen, with a blank line between each rectangle.

A 5 x 3 rectangle made of the letter 'O'

A 16 x 6 rectangle made of the letter 'T'

A 2 x 4 rectangle made of the left square bracket '%'

In the dimensions given above the first number is the horizontal width and the second number is the vertical height of the rectangle. Here is what output should look like. Program should be written in a flexible, general wayso that the rectangle dimensions and the letter/character used to print each rectangle can be changed easily without rewriting the whole program.

OOOOO

OOOOO

OOOOO

TTTTTTTTTTTTTTTT

TTTTTTTTTTTTTTTT

TTTTTTTTTTTTTTTT

TTTTTTTTTTTTTTTT

TTTTTTTTTTTTTTTT

TTTTTTTTTTTTTTTT

%%

%%

%%

%%

program must have a class called RectangleMaker to do most of the work. The class RectangleMaker should have

  1. Private fields that define:
    1. The dimensions of the rectangle (width & height)
    2. The character used to print the rectangle
  2. Mutator methods (setters) to set the fields.
  3. A print() method to print the rectangle.
  4. Optional accessor methods (getters), not necessary.
  5. The main() method that creates three objects (instances) of class RectangleMaker and call the print() methods. As usual keep program efficient and try to minimize the amount of duplicated code.

Important: There should be no use of 'static' variables or methods except for the main() method declaration itself. Use a class that creates objects of its own type in the main() method.

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

Pls help me solve this c++ assignment, asap!

Answered: 1 week ago