You could use a database and sql to query all that you want.
nanosani
Unauthenticated Liar
1,830 posts since Jul 2004
Reputation Points: 45
Solved Threads: 56
Hi eboney.
I know this is a late post, but this can be used for future reference. I'm not going to go in big detail on this, but maybe this will get you started. This code will take user input convert it into an integer. If the input is in the movieid array it will output the user input along with the corresponding movie title. I hope this helps you.
public class MovieTitle
{
public static void main(String []args)throws Exception
{
// Array examples
int [] movieId = {1001, 1002, 1003};
String [] movieTitle = {"title1001", "title1002", "title1003"};
// Declaring variables
String inputHolder = new String();
int x, y;
// Getting the user Input
System.out.print("Enter Movie ID: ");
char userInput = (char)System.in.read();
while(userInput >= '0' && userInput <= '9')
{
inputHolder = inputHolder + userInput;
userInput = (char)System.in.read();
}
System.in.read();
// Converting chars input to integer
int theId = Integer.parseInt(inputHolder);
// Executing for loop to match user Input to the correct movie title and ID
for(x = 0; x < movieId.length; ++x)
{
if(theId == movieId[x])
{
System.out.println("Id number " + theId + " matches movie title " + movieTitle[x]);
}
}
}
}
Banderson
Junior Poster in Training
66 posts since Aug 2004
Reputation Points: 17
Solved Threads: 8