Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public static String getFlag(int size, char color1, char color2, char color3) - This method returns a string where a triangle appears on the left size

public static String getFlag(int size, char color1, char color2, char color3) - This method returns a string where a triangle appears on the left size of the diagram, followed by horizontal lines. For example, calling DrawingApp.getFlag(9, 'R', '.', 'Y'); will generate the string:image text in transcribed

The diagram has a number of rows that corresponds to size * 2 and a number of colums that corresponds to size * 5. The first and last row will use color2 (except for the first character that will use color1). The center two rows will use color2 and the rest color3. The triangle will rely on color1 and will have a height corresponding to size * 2. If the size parameter is less than three, the method will return null and will not generate any diagram. For this method you can assume the colors are valid. The method MUST not rely on System.out.println().

1R..... 2 RRY RRRY 4 RRRRY 5 RRRRRY 6 RRRRRRY 7 RRRRRRRY 8 RRRRRRRRY 9 RRRRRRRRR..... 10 RRRRRRRRR.................................... 11 RRRRRRRRYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY 12 RRRRRRRY 13 RRRRRRY 14 RRRRRY 15 RRRRY 16 RRRY 17 RRYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY 18 R........ 1R..... 2 RRY RRRY 4 RRRRY 5 RRRRRY 6 RRRRRRY 7 RRRRRRRY 8 RRRRRRRRY 9 RRRRRRRRR..... 10 RRRRRRRRR.................................... 11 RRRRRRRRYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY 12 RRRRRRRY 13 RRRRRRY 14 RRRRRY 15 RRRRY 16 RRRY 17 RRYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY 18 R

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

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions

Question

How is the NDAA used to shape defense policies indirectly?

Answered: 1 week ago