Question
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!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started