SUNIL GUTTA

SUNIL GUTTA

  • NA
  • 1k
  • 394k

reversing the strings in different ways ?

Oct 26 2013 7:27 PM
Hi

Well thing is i have a file which contains data . so program should take that file as i/p and need to reverse the words in the fallowing manner and store it back

Please look at the exact requirement  ..

Write a Java program that reads in lines of text from a file then prints out the text with different transformations around the vertical, horizontal, and diagonal axis. The program will accomplish this by reading in the text as a rectangular block of data into a 2D array of characters (char[][]). The program will create only one 2D array and will not copy from one array to another. The dimensions of the 2D array will be contained in the first line of the input file, row first and then columns.

This is whats contained in the file:

4 4
JAVA
PROG
NUMB
FOUR

Apparently, the first 2 integer are there to tell us the row and columns according to our professor. so all we need to transform is the four words below that. And i have trouble reading Characters into the 2D array and tranform them around the vertical horizontal and diagonal axis.

The output supposed to be like this:

AVAJ
GORP
BMUN
RUOF

FOUR
NUMB
PROG
JAVA

RBGA
UMOV
OURA
FNPJ


I know how to code &  get the o/p of first two o/p scenarios .. but 3rd one i have no clue and finally how to store the entire results back .. 


cheers ty




Answers (3)