Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In a file Hw5.java write a public static method called printFrame that takes two integer parameters. This method should print a frame in the console

In a file Hw5.java write a public static method called printFrame that takes two integer parameters. This method should print a "frame" in the console window consisting of two squares, one centered inside of the other, with the corners of the squares connected with 45 degree "lines". The dimensions of the two squares are given by the two integer parameters (the larger parameter is the outer dimension and the smaller parameter is the inner dimension). Below are a few examples. If the difference between the two parameters is not an even integer, your method should decrease the smaller parameter by 1 and use that new value. If the two parameters are equal, your method should draw only the outer frame. If the smaller parameter is zero or negative (including after it has been adjusted), your method should return without printing anything.

The method call printFrame(20,12) should produce the following output in the console window. (Notice that these really are "squares" in that they have the same number of characters in their horizontal and vertical sides.)

 ******************** ** ** * * * * * * * * * ************ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ************ * * * * * * * * * ** ** ******************** 

The method call printFrame(6,24) should produce the following output. Notice that the larger of the two input integers should be the dimension of the outer "square".

 ************************ ** ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ****** * * * * * * * * * * * * * * * * * * ****** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** ** ************************ 

How can I do this using two nested for loops and one if statment on drjava?

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 Processing

Authors: David M. Kroenke

12th Edition International Edition

1292023422, 978-1292023427

More Books

Students also viewed these Databases questions

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago