Answer:
package Lab6Problema;
import java.util.Scanner;
public class Lab6Problema{
public static void H() // prints H
{
System.out.println();
System.out.println("** **");
System.out.println("** **");
System.out.println("******");
System.out.println("** **");
System.out.println("** **");
}
public static void E()//prints E
{
System.out.println();
System.out.println("******");
System.out.println("** ");
System.out.println("******");
System.out.println("** ");
System.out.println("******");
}
public static void L()//prints L
{
System.out.println();
System.out.println("* ");
System.out.println("* ");
System.out.println("* ");
System.out.println("* ");
System.out.println("******");
}
public static void O()//prints O
{
System.out.println();
System.out.println("******");
System.out.println("* *");
System.out.println("* *");
System.out.println("* *");
System.out.println("******");
}
public static void W()//prints W
{
System.out.println();
System.out.println("* *");
System.out.println("* *");
System.out.println("* ** *");
System.out.println("* ** *");
System.out.println("** **");
}
public static void R()//prints R
{
System.out.println();
System.out.println("***** ");
System.out.println("** **");
System.out.println("***** ");
System.out.println("** **");
System.out.println("** **");
}
public static void D()//prints D
{
System.out.println();
System.out.println("**** ");
System.out.println("* * ");
System.out.println("* *");
System.out.println("** * ");
System.out.println("**** ");
}
public static void blank() //prints blank space
{
System.out.println();
System.out.println();
System.out.println();
}
public static void main(String[] args) {
//just enter "Hello World" as input as specified
System.out.println("Enter a Message");
Scanner scan=new Scanner(System.in);
String myMessage=scan.nextLine(); // read msg using scanner
int numOfCharacters=myMessage.length();// calculate message lenth
for(int i=0;i<numOfCharacters;i++) // loop through each chracter in msg
{
// gets character at position i, and switch accordingly
switch(myMessage.charAt(i))
{
// if character is 'H' or 'h', call method H(). Similarly for other
// Hecharacters in message.
case 'H':
case 'h':H();break;
case 'E':
case 'e':E();break;
case 'L':
case 'l':L();break;
case 'O':
case 'o':O();break;
case 'W':
case 'w':W();break;
case 'R':
case 'r':R();break;
case 'D':
case 'd':D();break;
case ' ':blank();break;
}
}
}
}
Explanation: