I have attached my assignment. For some reason, my code isn't working properly. I've looked through it, but I can't seem to find the error. If anyone can help me, I would greatly appreciate it.
Here is my code:
import java.util.*;
public class Project_11_1 {
public static void main(String[] args) {
System.out.println("Welcome to the Movie List Application");
System.out.println();
System.out.println("There are 100 movie in the list");
String choice = "y";
Scanner sc = new Scanner(System.in);
ArrayList<String> animated = new ArrayList<String>();
animated.add("One Piece");
animated.add("Bleach");
animated.add("Naruto");
animated.add("HellSing");
animated.add("Final Fantasy 7 Advent Child");
ArrayList<String>drama = new ArrayList<String>();
drama.add("Vertigo");
drama.add("The GodFather");
drama.add("Touch of Evil");
drama.add("21 day");
drama.add("The Searcher");
Please post your code in code tags to preserve formatting. It helps us to help you.
What do you mean by "For some reason, my code isn't working properly"? Does it compile? Does it run? Do you get any errors or exceptions? If so, you need to post the entire error/exception message here (in code tags) so we know what is going on. Again, we can't help if we don't know what the problem is.
I do notice that you're supposed to have a Movie class and a single ArrayList of Movie entries, not four ArrayList objects full of strings.
Then you would have to look through the entire array list (of Movie objects) each time looking at the category field to see if it matches the user input. If so, you'd print the title.
Let us know what the problem with your code is and we'll try to help.
One thing you are doing incorrectly is to use == for testing Strings. You should use the equals() method for comparing two objects. The == operator is for primitives or for when you want to know if two pointers point to the same object.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.