Question

Write code that prints the word Diagonally, diagonally from left to right, top to bottom. When you display your answer it should look something like this:

DAGONALLY

public void printDiagonally( String word )

{

//CODE GOES HERE

}

0 0
Add a comment Improve this question Transcribed image text
Answer #1
//TestCode.java

public class TestCode {
    public static void printDiagonally( String word )
    {
        for(int i = 0;i<word.length();i++){
            for(int j = 0;j<i;j++){
                System.out.print(" ");
            }
            System.out.println(word.charAt(i));
        }
        //CODE GOES HERE

    }
    public static void main(String args[]) {
        printDiagonally("DIAGONALLY");
    }
}

0 Process finished with exit code 0

\color{red}Please\; upvote\;the \;solution \;if \;it \;helped.\;Thanks!?

Add a comment
Know the answer?
Add Answer to:
Write code that prints the word Diagonally, diagonally from left to right, top to bottom. When...
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
  • 9. A concordance is an alphabetical word list for a passage of text. Each word in...

    9. A concordance is an alphabetical word list for a passage of text. Each word in the concordance is mapped to an integer indicating the frequency of the word's occurrence. The constructor of Concordance has one String parameter that identifies the text file to be read. An incompleteConcordance class is below. public class Concordance public Concordance (String nameOfFileH concord new TreeMap<String, Integer 0 createConcordance (nameOfFile); //Constructor //nameOfFile the text file being read public void createConcordance (string filename)...) //Create a TreeMap...

  • Write a python code that takes in an number 0-9 and prints out the word of...

    Write a python code that takes in an number 0-9 and prints out the word of the number. For example 1 would print out one. Below is the skeleton of the code that needs to be filled in. def num2string(num): """ Takes as input a number, num, and returns the corresponding name as a string. Examples: num2string(0) returns "zero", num2string(1)returns "one" Assumes that input is an integer ranging from 0 to 9 """ numString = "" ################################### ### FILL IN...

  • Write a JAVA program that has a method which accepts a string and prints it back...

    Write a JAVA program that has a method which accepts a string and prints it back to the user with all vowels replaced with *'s (multiple asterisks not '*s') with a new line after the string. The method signature should look like this: public static void replacePrint(String input)

  • All JAVA code 6.2.2: Define a method printFeetInchShort, with int parameters numFeet and numInches, that prints...

    All JAVA code 6.2.2: Define a method printFeetInchShort, with int parameters numFeet and numInches, that prints using ' and " shorthand. Ex: printFeetInchShort(5, 8) prints: 5' 8" Hint: Use \" to print a double quote Sample program: import java.util.Scanner; public class HeightPrinter { /* Your solution goes here */ public static void main (String [] args) { printFeetInchShort(5, 8); System.out.println(""); return; } } 6.4.1: Define stubs for the methods called by the below main(). Each stub should print "FIXME: Finish...

  • Hello, so I need someone to look over this code and see if im on the...

    Hello, so I need someone to look over this code and see if im on the right path. I feel like im missing something. Here is the assignment: Create a class called Slogans. This class will extend the Thread class. This thread will read from a file several quotes that are on each line. It will pick a quote randomly and display it to the console. It will change quotes every 7 seconds. This will be updated in the final...

  • A palindrome is a word, phrase, or sequence that reads the same backward as forward, e.g.,...

    A palindrome is a word, phrase, or sequence that reads the same backward as forward, e.g., madam or nurses run. In this program, ask the user to input some text and print out whether or not that text is a palindrome. Create the Boolean method isPalindrome which determines if a String is a palindrome, which means it is the same forwards and backwards. It should return a boolean of whether or not it was a palindrome. Create the method reverse...

  • You are going to write an object that takes a word (or short phrase) as an...

    You are going to write an object that takes a word (or short phrase) as an input for the Constructor and then will reverse the letters in the word. The object to implement this is referred to as **ReverseWord** and consists of **only** the following public methods: **public void setWord(String word)** - Sets the word to be processed. **public String getWord()** - Returns the word that is set with **setWord**. Note that if this is called before setWord then an...

  • For this assignment, you will write a program to work with Huffman encoding. Huffman code is...

    For this assignment, you will write a program to work with Huffman encoding. Huffman code is an optimal prefix code, which means no code is the prefix of another code. Most of the code is included. You will need to extend the code to complete three additional methods. In particular, code to actually build the Huffman tree is provided. It uses a data file containing the frequency of occurrence of characters. You will write the following three methods in the...

  • Bottom section is the what they expect in the code in java Create a class in...

    Bottom section is the what they expect in the code in java Create a class in JobApplicant.java that holds data about a job applicant. Include a name, a phone number, and four Boolean fields that represent whether the applicant is skilled in each of the following areas: word processing, spreadsheets, databases, and graphics. Include a constructor that accepts values for each of the fields. Also include a get method for each field. The get method should be the field name...

  • // Header code for stack // requesting to create source code using C++ #ifndef Stack_h #define...

    // Header code for stack // requesting to create source code using C++ #ifndef Stack_h #define Stack_h #include <stdio.h> #include <string> #include <iostream> using namespace std; class Stack { public: Stack(); ~Stack(); bool empty(); string top(); void push(const string &val); void pop(); void display(ostream &out); private: class Node { public: string word; Node *next; }; Node *tos; }; #endif Header file provided above. PLS create source code for functions declared in the header. If changes are need no make in...

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
Active Questions
ADVERTISEMENT