Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Learning Outcomes: 3.1, 3.3, 4.1,4.2 No. of Questions: 5 Total Points Submission: 10 Submit a java file named _LAB5 java 1. Write a program that

image text in transcribed
image text in transcribed
Learning Outcomes: 3.1, 3.3, 4.1,4.2 No. of Questions: 5 Total Points Submission: 10 Submit a java file named _LAB5 java 1. Write a program that generates random integers between 3 and 30 (both inclusive). Build a method called printHouse that is passed an odd integer n (the first odd randomly generated integer above) and a string s (choose between ,and "", and that prints a house-like shape using s. The top of the house is a pyramid and the bottom of the house is a square with one less row. The top row of the pyramid prints the string a single time. The second row prints two extra strings and so on. The last row of the pyramid prints n strings. You must reuse the methods you've already written in the class especially makeRow. Sample: Calling printHouse(11, from main, prints the following: ORRSes So basically, if n is 11, 6 rows of pyramid and 5 rows of squares are printed. You have to find out what if n is 13 or 21 or 23 etc. Your whole solution hinges upon the loop counters. Be wise

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_2

Step: 3

blur-text-image_step3

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

More Books

Students also viewed these Databases questions

Question

8. Design office space to facilitate interaction between employees.

Answered: 1 week ago