Menu
Question Index
...


Write a program to create banner with left align text. Leave 2 extra spaces on the right and left sides as margin. Use System.out.print or System.out.println for printing.

Input (String, Banner Width) Output
Sri Mohandas Karamchand Gandhi, 12 ******************
#                #
#  Sri Mohandas  #
#  Karamchand    #
#  Gandhi        #
#                #
******************
Sri Avul Pakir Jainulabdeen Abdul Kalam, 15 *********************
#                   #
#  Sri Avul Pakir   #
#  Jainulabdeen     #
#  Abdul Kalam      #
#                   #
*********************
Sri Moulana Abul Kalam Azad, 8 **************
#            #
#  Sri       #
#  Moulana   #
#  Abul      #
#  Kalam     #
#  Azad      #
#            #
**************
Sri Lal Bahadur Shastri, 10 ****************
#              #
#  Sri Lal     #
#  Bahadur     #
#  Shastri     #
#              #
****************

class BannerWithLeftAlign

{    public static void main(String s[])
    {
        printBanner("Sri Avul Pakir Jainulabdeen Abdul Kalam", 15);

    }


public static void printBanner(String name, int rectWidth) {
//Write code here to create banner with left align.
}

//Use this for writing additional methods if required
}

Doubts

Problems

Topic: Java ArrayList

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App