Results 1 to 6 of 6
Thread: I need DIRE DIRE HELP
- 03-11-2010, 03:33 AM #1
Member
- Join Date
- Mar 2010
- Posts
- 78
- Rep Power
- 0
I need DIRE DIRE HELP
i cant run any program, becuase i think the path is set wrong, but i did wat im supposed to. i copied the address of the bin folder of the jdk folder, and i put it in the CLASSPATH under environment variables. and it still doesnt work. i cant check my code, and this is due tomorrow. i need major help. this is what im asking:
~does it run correctly?
~i need to make it so the user can enter words until they want to stop, i guess by typing -1 or sumthing, but idk how to do that. heres my code. i need help please. im crying.
import java.util.Scanner;
public class labtoo
{
public static void main(String[] args)
{
String[] EnglishArray = {"cat", "dog", "house", "table", "turtle", "water", "yellow", "zoo"};
String[] SpanishArray = {"gato", "perro", "casa", "mesa", "tortuga", "agua", "amarillo", "zoologico"};
Scanner keyboard = new Scanner(System.in);
int languageSelect = 0;
String wordToSearch = null;
boolean found = false;
System.out.println("Would you like to start in english(Enter 1) or in spanish(enter 2)?");
languageSelect = keyboard.nextInt();
if (languageSelect == 1)
{
while (found != true)
{
System.out.println("What word would you like to find? Example: 'cat' ");
wordToSearch = keyboard.next();
for (int i = 0; i> EnglishArray.length; i++)
{
if (wordToSearch == EnglishArray[i])
{
System.out.println("The Spanish equivalent of " + wordToSearch + " is " + SpanishArray[i]);
found = true;
}
}
}
}
else if (languageSelect == 2)
{
while (found != true)
{
System.out.println("What word would you like to find? Example: 'perro'? ");
wordToSearch = keyboard.next();
for (int i = 0; i> EnglishArray.length; i++)
{
if (wordToSearch == EnglishArray[i])
{
System.out.println("The English equivalent of " + wordToSearch + " is " + EnglishArray[i]);
found = true;
}
}
}
}
else
{
System.out.println("Please Enter either 1 for English or 2 for Spanish");
languageSelect = keyboard.nextInt();
}
}
}
- 03-11-2010, 03:55 AM #2
hi,some probelms in programing see the difference
import java.util.Scanner;
public class labtoo
{
public static void main(String[] args)
{
String[] EnglishArray = {"cat", "dog", "house", "table", "turtle", "water", "yellow", "zoo"};
String[] SpanishArray = {"gato", "perro", "casa", "mesa", "tortuga", "agua", "amarillo", "zoologico"};
Scanner keyboard = new Scanner(System.in);
int languageSelect = 0;
String wordToSearch = null;
boolean found = false;
System.out.println("Would you like to start in english(Enter 1) or in spanish(enter 2)?");
languageSelect = keyboard.nextInt();
if (languageSelect == 1)
{
while (found != true)
{
System.out.println("What word would you like to find? Example: 'cat' ");
wordToSearch = keyboard.next();
for (int i = 0; i<EnglishArray.length; i++)
{
if (wordToSearch.equalsIgnoreCase(EnglishArray[i]))
{
System.out.println("The Spanish equivalent of " + wordToSearch + " is " + SpanishArray[i]);
found = true;
}
}
}
}
else if (languageSelect == 2)
{
while (found != true)
{
System.out.println("What word would you like to find? Example: 'perro'? ");
wordToSearch = keyboard.next();
for (int i = 0; i<SpanishArray.length; i++)
{
if (wordToSearch.equalsIgnoreCase(SpanishArray[i]))
{
System.out.println("The English equivalent of " + wordToSearch + " is " + EnglishArray[i]);
found = true;
}
}
}
}
else
{
System.out.println("Please Enter either 1 for English or 2 for Spanish");
languageSelect = keyboard.nextInt();
}
}
}
if your path is not set yet then it won't work properly
- 03-11-2010, 04:04 AM #3
Member
- Join Date
- Mar 2010
- Posts
- 78
- Rep Power
- 0
dfijoadspfjdpf
Last edited by Meta; 03-11-2010 at 05:34 AM.
- 03-11-2010, 04:22 AM #4
Member
- Join Date
- Mar 2010
- Posts
- 78
- Rep Power
- 0
is it easy to change from if statements to methods for the translations?
- 03-11-2010, 04:59 AM #5
Member
- Join Date
- Mar 2010
- Posts
- 78
- Rep Power
- 0
plz!!! how do i loop this until the user says STOP! :( i need to go to bed. this is duei n morning. im crying
- 03-11-2010, 08:39 AM #6
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
There are two environment variables that need to be set: your PATH variable has to point to the bin directory of your JDK; this is not a Java issue but an OS issue: it needs to find the executable files javac.exe and java(w).exe.
The other variable is CLASSPATH; it's a list of directories where your jvm has to look for .class and/or .jar files. You can also set this variable by using -classpath <dirlist> on the command line of any java utility (javac, java, etc).
kind regards,
Jos
Similar Threads
-
I Am In Dire Need Of Help
By diptarka.ray in forum Advanced JavaReplies: 2Last Post: 10-20-2008, 09:39 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks