3 Replies - 1155 Views - Last Post: 23 February 2008 - 02:48 PM Rate Topic: -----

#1 student2007   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 04-December 07

JAVA help.stuck..any help will be appreciated?

Post icon  Posted 22 February 2008 - 11:26 PM

Hey

am working on a small problem for java. I am new to java, so any help to get me started would be greatly appreicated. I am trying to get the user to input a single phrase/string/word. Then store that into a array (5*5). Then since there will be empty boxes left over, I want the program to automatically fill in the rest of the empty boxes in the array with the rest of the alphabet(starting with the first letter in the alphabet that is not used in the phrase and omitting the words already used and the letter X) from left to right all the way until it is filled. for example. if the user enters the workd "computer"

then matrix should look like:
c o m p u
t e r a b
d f g h i
j k l n q
s v w y z

This is the problem and I have no idea how to do this. i have some start, but i am not able to get it, if anyone can provide help, please let me know. thanks in advance.this hw problem is due tomm...and i have tried all options. please help if u can. thnks in advance.

Is This A Good Question/Topic? 0
  • +

Replies To: JAVA help.stuck..any help will be appreciated?

#2 Nayana   User is offline

  • DIC Hawk - 나야나 नयन:
  • member icon

Reputation: 32
  • View blog
  • Posts: 824
  • Joined: 14-November 07

Re: JAVA help.stuck..any help will be appreciated?

Posted 23 February 2008 - 12:28 AM

Please post what you have so far.

Please use the code tags like so:
[*code=java]code goes here[*/code]

Without the *'s of course.
Was This Post Helpful? 0
  • +
  • -

#3 student2007   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 04-December 07

Re: JAVA help.stuck..any help will be appreciated?

Posted 23 February 2008 - 02:20 PM

public class hw1
{
	public static String getPhrase(){
		return this.phrase;
		
	}
	
	public static String getMessage(){
		return this.message;
	}
	
	public static void main(String[] args) 
	{	
		
		Scanner keyboard = new Scanner(System.in);
		//Variables
		alpha = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'y', 'z'}
		
		
		
		//Enter Pharse
		System.out.println("enter the phrase into the 5*5 array. ");
		String getPhrase = keyboard.nextLine();
		
		//Decode or Encode the message
		System.out.println("decode or encode the message? ");
		String option = keyboard.nextLine();
		
		//Enter Message
		System.out.println("enter message you want to Encode or Decode:);
		String getPhrase = keyboard.nextLine();
		
		
		//Decode code
		
		//Encode code

	}

}





Was This Post Helpful? 0
  • +
  • -

#4 student2007   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 04-December 07

Re: JAVA help.stuck..any help will be appreciated?

Posted 23 February 2008 - 02:48 PM

View PostNayana, on 23 Feb, 2008 - 12:28 AM, said:

Please post what you have so far.

Please use the code tags like so:
[*code=java]
public class hw1
{
public static String getPhrase(){
return this.phrase;

}

public static String getMessage(){
return this.message;
}

public static void main(String[] args)
{

Scanner keyboard = new Scanner(System.in);
//Variables
alpha = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'y', 'z'}



//Enter Pharse
System.out.println("enter the phrase into the 5*5 array. ");
String getPhrase = keyboard.nextLine();

//Decode or Encode the message
System.out.println("decode or encode the message? ");
String option = keyboard.nextLine();

//Enter Message
System.out.println("enter message you want to Encode or Decode:);
String getPhrase = keyboard.nextLine();


//Decode code

//Encode code

}

}[*/code]

Without the *'s of course.

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1