Hey im abit of a novice at all of this programming, but im trying to give it ago anyway. What im wanting to do is write a program that takes an array of words which wil then return ana array which alphabetically come after a certain word, in this case "Juice" for example (its not that important what the word is) the array should be around 10 words long to begin with.

If anyone can give me any help it would be mucho appreciated.

I'm a bit confused. Do you want to input an array of strings and then alphabatize them? I can't understand your wording, maybe you could make it a bit clearer for us.

Basically yes. I want to input an array of words, which then display all of the words inputted that come after the word "Juice", So if something like "apple" was inputted it would not display it. If "zebra" was inputted then it would display it at the end.

I hope that clears things up a little bit.

Member Avatar for iamthwee

Basically yes. I want to input an array of words, which then display all of the words inputted that come after the word "Juice", So if something like "apple" was inputted it would not display it. If "zebra" was inputted then it would display it at the end.

I hope that clears things up a little bit.

Yes it is possible, what ideas do you have? What code have you got so far?

At the moment none (i've been doing other parts in java) basically i dont really know how to start it, as i've not been doing java that long. So if someone could point me in the right direction it'd be cool

Member Avatar for iamthwee

At the moment none (i've been doing other parts in java) basically i dont really know how to start it, as i've not been doing java that long. So if someone could point me in the right direction it'd be cool

Ok forget code, for the time being, pretend you just have to write down the process in plain english. Do that first, then try again.

hey iamtwee,
give the man a break and spell out 'hello world'...that's a (the) start, isn't it?!

and derby....if iamtwee doesn't, i will

hello (in the java) world!
peter

Well but I think I may have some suggestions. First off, if you would like to have someone type a word in and the you will read it and input it, the EasyReader element is good. It will allow you to ask people to input a word, and then you can put it into a spot (array). I could always e-mail you the .java file and for easyreader. But below I will show you an example I made for a class at one point.

/*
 /*	Date: 11/17/05						   	  
 /*	List of names, user has options to add, print forwards   
 /*	Print backwards, and exit. 					          
 /* Saved As: prog10.java								     
 */
 
public class prog10
{
	static int userList;    // current number of actual elements in list
	
	public static void main(String[ ] args)
	{	
		EasyReader console = new EasyReader();
		
		System.out.print("Type a number of names for the list: ");
		userList = console.readInt();
		console.readLine();   // take the remaining return
		int list = 100;
		String[] names = new String[list];
		
		
		for(int x=0;x<userList;x++)
			{
			System.out.print("Type a name to add to the list: ");
			names[x] = console.readLine();
			
			}
		
		int choice = 0;
		
		while(choice != 4)
		{
		System.out.println("Choose an option:");
		System.out.println("1. Add a name");  //addName
		System.out.println("2. Print forwards");  //printFor
		System.out.println("3. Print backwards");  //printBack
		System.out.println("4. Exit");  //
		System.out.print("Please enter a number: ");
		choice = console.readInt();
		
		switch (choice)
 		{
 			case 1:
 				addName(names);
 				break;
 		
 			case 2:
 				printFor(names);
 				break;
 		
 			case 3:
 				printBack(names);
 				break;
		} 	
 		}
	}

	public static void addName(String [] names)
	{
		EasyReader console = new EasyReader();
		
		System.out.print("Type a new name: ");
		names[userList] = console.readLine();
		userList++;

		System.out.println("\n");
	}		

	public static void printFor(String [] names)
	{
		EasyReader console = new EasyReader();
		
		for(int i = 0;i<userList;i++)
			{
			System.out.println(names[i]);	
			}
		System.out.println("\n");
	}

	public static void printBack(String [] names)
	{
		EasyReader console = new EasyReader();
		
		for(int i = userList-1;i>=0;i--)
			{
			System.out.println(names[i]);	
			}
		System.out.println("\n");		
	}
}

Although this doesn't alphabetize the words, I could helpy uo figure that out. I'm no expert but I've done programs like what you are doing for class also.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.