Answered step by step
Verified Expert Solution
Question
1 Approved Answer
jGRASP, Java Topics This assignment will give you practice with parameters, nested for loops, print/println statements and a class constant. Details You may have noticed
jGRASP, Java
Topics This assignment will give you practice with parameters, nested for loops, print/println statements and a class constant. Details You may have noticed that our style guide asks you to keep your individual lines of code below 100 characters. Some people (myself included) read code in an editor that works better if you keep your lines below 80 characters. Sometimes, in the header comment for my code, I like to include a decorative line (or more than one) that is EXACTLY 80 characters (or 100) so that it is a visual reminder of when to cut myself off. We're going to review what we've learned so far by creating some of these decorative lines. Instructions You are to write a method printSampleLines that can produces an ASCII Art line (or more than one) that cuts off precisely at 100 characters. Example: IAVA AVAVI o Your method should take a parameter that indicates how many lines of the art to produce, if you want a bigger barrier at the beginning of your code. For example, printSamplelines(5) would print 0 VAVA IAVAVI VA IAVA WA IAVAVA WA IAVAVA WA IAVAVA VAVA AVA AVAVI WAV VA VAVI IAVAV WA . You should use nested loops inside printSampleLines to reduce repeating code for specific characters on a given line, or between lines. You should use a method to print the most basic building block of the code ( //V) and return the number of characters in that building block For example: if you have a method that prints //\, it returns 4 Another example: a method that prints --, it returns 2 Once you have implemented this second method, it should remove any print statements (other than new lines!) in your printSamplelines() code. You should have appropriate logic in printSamplelines() to make your nested for loop work for blocks of any size, but always cut off at the right number of TOTAL characters. Your main should simply call printSamplelines(5). You are required to properly indent your code and will lose points if you make indentation mistakes. You should begin by trying to reproduce the figure above exactly. Once you can reproduce a single line, move on the multi-line version. If that is complete, attempt the version with printBuilding Block() and an appropriate return value. Additionally, include a comment above each method that you write describing what that method does. Comments should not be in-line with the method header, but instead should come on a separate line immediately before the method. // This method prints the bottom portion public static void bottom { }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