Menu
Question Index
...


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

Input (String, Banner Width) Printed Output
Bhimrao Ramji Ambedkar, 10 ****************
#              #
#     Bhimrao  #
#       Ramji  #
#    Ambedkar  #
#              #
****************
Netaji Subhas Chandra Bose, 9 ***************
#             #
#     Netaji  #
#     Subhas  #
#    Chandra  #
#       Bose  #
#             #
***************
Atal Bihari Vajpayee, 8 **************
#            #
#      Atal  #
#    Bihari  #
#  Vajpayee  #
#            #
**************
Pamulaparthi Venkata Narasimha Rao, 15 *********************
#                   #
#     Pamulaparthi  #
#          Venkata  #
#    Narasimha Rao  #
#                   #
*********************

class BannerWithRightAlign

{    public static void main(String s[])
    {
        printBanner("Bhimrao Ramji Ambedkar", 10);

    }


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

//Write any additional methods here
}

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