Question

Please write this in java

Write one static method to print each character in the

output. There should be methods to print: H, E, L, O,

(comma), W, R, D and (exclamation point). The method

to print H should be called printH() and the method to

print the comma should be called printComma(). Make

sure to separate characters with a new line in the method

(except the comma) as shown on right. Write a method called printHelloWorld() to call the

character print methods to print Hello, World! Call printHelloWorld() from main().

Here is what it should look like

HEHHH rEEr 3 1.1

0 0
Add a comment Improve this question Transcribed image text
Answer #1


public class HelloWorld {
   public static void printH() {
       System.out.println("H   H\nH   H\nHHHHH\nH   H\nH   H\n");
   }
   public static void printE() {
       System.out.println("EEEEE\nE\nEEEE\nE\nEEEEE\n");
   }
   public static void printL() {
       System.out.println("L\nL\nL\nL\nLLLLL\n");
   }
   public static void printO() {
       System.out.println("OOOOO\nO   O\nO   O\nO   O\nOOOOO\n");
   }
   public static void printW() {
       System.out.println("W   WW   W\nW   WW   W\n W W W W\n W W W W\n W    W\n");
   }
   public static void printR() {
       System.out.println("RRRRR\nR   R\nRRRRR\nR R \nR   R\n");
   }
   public static void printD() {
       System.out.println("DDDD\nD   D\nD   D\nD   D\nD D\n");
   }
   public static void printExclamationPoint() {
       System.out.println("! !\n! !\n! !\n\n! !\n");
   }
   public static void printComma() {
       System.out.println(", ,\n,\n");
   }
   public static void printHelloWorld() {
       printH();
       printE();
       printL();
       printL();
       printO();
       System.out.println('\n');
       printComma();
       printW();
       printO();
       printR();
       printL();
       printD();
       printExclamationPoint();
      
   }

   public static void main(String[] args) {
       printHelloWorld();
      
   }

}

Add a comment
Know the answer?
Add Answer to:
Please write this in java Write one static method to print each character in the output....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • in Java please (a) Write a static method abbreviate( ) which is passed a String s...

    in Java please (a) Write a static method abbreviate( ) which is passed a String s and an int max. The method returns a new String which contains the content of s abbreviated to at most max characters, but where the last three characters are ellipses (i.e., the characters . . .). For example, if s is "Too bad Spongebob’s not here to enjoy Spongebob not being here. ---Squidward." and max is 10, the method returns the 10-character String "Too...

  • I need java code for the following problem. Lab 7: Methods 1. Write a Java program called Numbers that calls the following methods and displays the returned value: Write a method called cubelt that a...

    I need java code for the following problem. Lab 7: Methods 1. Write a Java program called Numbers that calls the following methods and displays the returned value: Write a method called cubelt that accepts one integer parameter and returns the value raised to the third power as an integer. o Write a method called randominRange that accepts two integer parameters representing a range. The method returns a random integer in the specified range inclusive. 2. o Write a method...

  • CIST 2371 Introduction to Java Unit 03 Lab Due Date: ________ Part 1 – Using methods...

    CIST 2371 Introduction to Java Unit 03 Lab Due Date: ________ Part 1 – Using methods Create a folder called Unit03 and put all your source files in this folder. Write a program named Unit03Prog1.java. This program will contain a main() method and a method called printChars() that has the following header: public static void printChars(char c1, char c2) The printChars() method will print out on the console all the characters between c1 and c2 inclusive. It will print 10...

  • Write a method called printReverse() that takes a string and uses recursion to print the contents...

    Write a method called printReverse() that takes a string and uses recursion to print the contents of the string in reverse order. The string itself should not be reversed; it must be left in its original form. The method has the following header:   void printReverse(String s, int i) where s is a reference to the string, and i is an integer parameter that you may use as you see fit. You do not need to code up this method as...

  • Java Code Help! Code this: Calculate statistics. Write a class called Statistics that can calculate a...

    Java Code Help! Code this: Calculate statistics. Write a class called Statistics that can calculate a number of properties about an array of doubles. There should be separate static methods to calculate the min, the max, the mean, the median, the standard deviation (make sure to make use of your mean method to implement this), and the mode. For the mode, you can assume that the data set is not multimodal. This class should not have a main method. Write...

  • JAVA Write a static method that takes an array of a generic type as its only...

    JAVA Write a static method that takes an array of a generic type as its only argument. The method should display the array and return the number of elements in the array. Test the method in main with at least three arrays of objects. SAMPLE OUTPUT Here is an Integer array 12 21 7 16 8 13 That array held 6 elements Here is a String array one two three four That array held 4 elements Here is a Double...

  • Write a program that deletes an element of a one-dimensional array of characters. The program should:...

    Write a program that deletes an element of a one-dimensional array of characters. The program should: Ask user to input the number of characters in the array the values of the array a character to be deleted Call a method to delete the character Print the resulting array or, if the character is not found, print “Value not found” The method called by the main program should: Pass the array and the character to be found as parameters If the...

  • The Language is Java GenericMethodTest (20) Download the OverloadedMethods.java program. Replace all the methods except main...

    The Language is Java GenericMethodTest (20) Download the OverloadedMethods.java program. Replace all the methods except main with a single generic method that produces the same output. Call the new file GenericMethodsTest.java. OverloadMethods.java: // Printing array elements using overloaded methods. public class OverloadedMethods { // method printArray to print Integer array public static void printArray(Integer[] inputArray) { // display array elements for (Integer element : inputArray) { System.out.printf("%s ", element); } System.out.printf("\n"); } // method printArray to print Double array public...

  • create a new Java application called "CheckString" (without the quotation marks) according to the following guidelines....

    create a new Java application called "CheckString" (without the quotation marks) according to the following guidelines. ** Each method below, including main, should handle (catch) any Exceptions that are thrown. ** ** If an Exception is thrown and caught, print the Exception's message to the command line. ** Write a complete Java method called checkWord that takes a String parameter called word, returns nothing, and is declared to throw an Exception of type Exception. In the method, check if the...

  • Java: Write a static method named longestName that reads a series of names typed by the...

    Java: Write a static method named longestName that reads a series of names typed by the user and prints the longest name (i.e., the name with the most characters). The method should accept a Scanner object, console and an integer, n as parameters. After prompting and reading in n names, the longest name should be printed as follows: its first letter should be capitalized and all subsequent letters lowercase, regardless of how the user entered the name. If there is...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT