Answered step by step
Verified Expert Solution
Question
1 Approved Answer
10. PLEASE INCLUDE COMMENTS IN CODE (so that I can understand why you did certain things) Write a program that reads in lines from the
10.
PLEASE INCLUDE COMMENTS IN CODE (so that I can understand why you did certain things)
Write a program that reads in lines from the input. Each ine has two integer values followed by a single character. The objective is to print a rectangle pattem using the input patterm. The first integer represents the number of rows and the second integer represents the number of columns. nput The format of an input lne is The first two are integers (and can be read using nextint) The last one is a single character (like)and can be read using next) as a String and then using charAtiOl to get at the first character Output For each line of input, a rectangular pattern is printed consisting of several rows. If the no of rows or cols is lethan or equal to zero or more than so, the program prints out an error statement as shown in the sample output 2 2, 2 51 10 10 0 11 error in input error in input HINT 1. use innext[].charAtt to get the character. 2. don't forget to discard the rest of the input line using in.nextlineO if you are using in.hasNextline) to check if there is a next line 3. You will need TWO loops to print each rectangleStep 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