Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that can print a banner with rotated letters, such that they can be read from top to bottom. Specifically, each letter in

Write a program that can print a banner with rotated letters, such that they can be read from top to bottom. Specifically, each letter in the message should be printed using multiple lines composed of * symbols. The code to print each letter should go into a separate method just for that letter (no parameters, no return value). Dont worry, you dont need to make 26 different methods, just 8: the seven letters in the message Hello World (D, E, H, L, O, R, and W) and a space. In your main method, you should ask the user to type a message. Then, loop through each character in the message and, for each character, if you have a corresponding method, call the method to print out the letter to the screen, ignoring any other characters. To help get you started, here is an example method for the letter D:

public static void d() {

System.out.printf("%n");

System.out.printf("*******%n");

System.out.printf("* *%n");

System.out.printf("* *%n");

System.out.printf(" * * %n");

System.out.printf(" *** %n");

System.out.printf("%n");

}

And an example method for the blank space (notice each has a blank line before/after):

public static void blank() {

System.out.printf("%n%n%n");

}

Reference the JUnit tests to see how to print the other letters. Here are a few tips for your main method:

To read an entire message, including spaces, use a Scanner variables nextLine() method.

To get the number of characters in a string variable, use that String variables length() method.

To get a particular character in a string, use a String variables charAt() method. Note that this method will want to know which character, and so you should provide it as an argument. Remember that in Java we begin counting at 0, so to get the third character of the String variable myMessage, you would write myMessage.charAt(2).

You should ignore case that is, call the d() method whether the message contains a d or a D.

Here is an example run of the program (notice the missing characters):

Input message: Hello Bye!

image text in transcribed

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_2

Step: 3

blur-text-image_3

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

Current Trends In Database Technology Edbt 2006 Edbt 2006 Workshops Phd Datax Iidb Iiha Icsnw Qlqp Pim Parma And Reactivity On The Web Munich Germany March 2006 Revised Selected Papers Lncs 4254

Authors: Torsten Grust ,Hagen Hopfner ,Arantza Illarramendi ,Stefan Jablonski ,Marco Mesiti ,Sascha Muller ,Paula-Lavinia Patranjan ,Kai-Uwe Sattler ,Myra Spiliopoulou ,Jef Wijsen

2006th Edition

3540467882, 978-3540467885

More Books

Students also viewed these Databases questions