Question
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
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