Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

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 rectangle

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

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

More Books

Students also viewed these Databases questions

Question

LO4 Identify a system for controlling absenteeism.

Answered: 1 week ago