Menu
Question Index
...


Write a program to draw alphabet rectangles using given input. In the input the rectangles are given as start-x, start-y, width and height. Eg., [{1,4,2,3}] In this the rectangle starts at (1,4) positions having 2 columns and 3 rows. The rectangle should print alphabets from A-Z and restart from A when it crosses Z. When two rectangles intersect the alphabets should be added and the resultant alphabet should be printed. For eg. 'A' + 'A' = 'B', 'M' + 'C' = 'P', 'X' + 'D' = 'B'

Input (int[][]) Output
{{0,0,3,4}} ABC
DEF
GHI
JKL
{{0,0,6,6}} ABCDEF
GHIJKL
MNOPQR
STUVWX
YZABCD
EFGHIJ
{{1,0,2,3}} .AB
.CD
.EF
{{0,5,10,1}, {5,0,1,10}} .....A....
.....B....
.....C....
.....D....
.....E....
ABCDELGHIJ
.....G....
.....H....
.....I....
.....J....
{{0,3,4,4}, {5,0,3,3}} .....ABC
.....DEF
.....GHI
ABCD....
EFGH....
IJKL....
MNOP....
{{0, 0, 3, 3}, {1, 1, 3, 3}} ABC.
DFHC
GLNF
.GHI

class DrawAlphabetRectangles

{    public static void main(String s[])
    {
        int[][] rects = {{0, 3, 4, 4}, {5, 0, 3, 3}};
        drawRects(rects);

    }


public static void drawRects(int[][] rects) {
//Write code here to draw alphabet rectangles.
}

//If required write any additional methods here.
}

Doubts

Problems

Topic: Learn Arrays And Loops

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App