Menu
Question Index
...


Write a program to slide the words horizontally such that they form all the lookup words vertically. Also print the words as shown below in the requirements.

Input (List, List) Printed Output
[JIFFY, PASTULA, AVIONIC, POTATO], [JAVA, IS, FUN]          [J][I] F [F] Y
       P [A][S] T [U] L  A
       A [V] I  O [N] I  C
 P  O  T [A] T  O
[POTATO, MONOTIM, TOMATO], [POT, TOM, TIT]    [P] O [T] A [T] O
 M [O] N [O] T [I] M
   [T] O [M] A [T] O
[BOPA, ANIMAL, TANGOO, MAT], [BAT, ON, PIN, LOT] [B][O][P] A
[A][N][I] M  A [L]
[T] A [N] G  O [O]
          M  A [T]
[BOOM, SUFI, TONY, DUD], [OUT, OF, MIND]  B [O][O][M]
 S [U][F][I]
   [T] O [N] Y
    D  U [D]
[WTA, RIHL, NELLORE, OM], [WIN, THEM, ALL]    [W][T][A]
 R [I][H][L]
   [N][E][L] L  O  R  E
    O [M]

class SlideWords

{    public static void main(String s[])
    {
        List words = new ArrayList();
        words.add("JIFFY");
        words.add("PASTULA");
        words.add("AVIONIC");
        words.add("POTATO");
        List lookupWords = new ArrayList();
        lookupWords.add("JAVA");
        lookupWords.add("IS");
        lookupWords.add("FUN");
        printSlidWords(words, lookupWords);

    }


public static void printSlidWords(List<String> words, List<String> lookupWords) {
//Write code here to slide the words and print them as per the requirements
}

//If required, write any additional methods here.
}

Doubts

Problems

Topic: Java ArrayList

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App