film class

import java.util.Scanner;

// Creating Class Members
public class film {
	private	String itemCode;
	private	String title;
	private	String description;
	private	String language;
	private	String runningTime;
	private	String productionCompany;
	private	String status; //eg, pending, premiering, running, written-off

    // No-argument Constructor: Without Parameters
    public film() {
    	itemCode = "";
    	title = "";
    	description = "";
    	language = "";
    	runningTime = "";
    	productionCompany = "";
    	status = "";
    }
    
    // With Argument Constructor: With Parameters
    public film(String itemCode, String title, String description, String language, String runningTime, String productionCompany, String status){
    	this.itemCode = itemCode;
    	this.title = title;
    	this.description = description;
    	this.language = language;
    	this.runningTime = runningTime;
    	this.productionCompany = productionCompany;
    	this.status = status;
    }

    //Copy Constructor
    public film(film films){
		itemCode = films.itemCode;
    	title = films.title;
    	description = films.description;
    	language = films.language;
    	runningTime = films.runningTime;
    	productionCompany = films.productionCompany;
    	status = films.status;    	
    }
    
    //Setter & Getter Method, From: itemCode - status
    public void setItemCode(String itemCode){
    	this.itemCode = itemCode;
    }
    public String getItemCode(){
    	return itemCode;
    }
    
    public void setTitle(String title){
    	this.title = title;
    }
    public String getTitle(){
    	return title;
    }
    
    public void setDescription(String description){
    	this.description = description;
    }
    public String getDescription(){
    	return description;
    }
    
    public void setLanguage(String language){
    	this.language = language;
    }
    public String getLanguage(){
    	return language;
    }
    
    public void setRunningTime(String runningTime){
    	this.runningTime = runningTime;
    }
    public String getRunningTime(){
    	return runningTime;
    }
    
    public void setProductionCompany(String productionCompany){
    	this.productionCompany = productionCompany;
    }
    public String getProductionCompany(){
    	return productionCompany;
    }
    
    public void setStatus(String status){
    	this.status = status;
    }
    public String getStatus(){
    	return status;
    }
    
    //Method equals that return true if two objects contain the same information
    public boolean equals(film filmsCompare){
    	if(itemCode.equals(filmsCompare.itemCode) && title.equals(filmsCompare.title) && description.equals(filmsCompare.description) && language.equals(filmsCompare.language) &&
    		runningTime.equals(filmsCompare.runningTime) && productionCompany.equals(filmsCompare.productionCompany) && status.equals(filmsCompare.status))
    		return true;
    	else
    		return false;
    }
}

collection class

import java.util.Scanner;

public class collection {
	film[] films = new film[100];
	static int numberFilm = 0;
	film[] arrFilms = new film[numberFilm];

	//User Input Film Method
	public void inputFilm(){
		Scanner scan = new Scanner(System.in);

		System.out.println();
		System.out.println("Add New Films");
		System.out.println("=============");
		
		for(char option = 'Y'; option == 'Y';){
			System.out.print("Item Code: ");
			String code = scan.next();
				
		    System.out.print("Title: ");
		    String title = scan.next();
		    	
		    System.out.print("Description: ");
		    String description = scan.next();
		    	
		    System.out.print("Language: ");
		    String language = scan.next();
		    
		    System.out.print("Running Time(00:00): ");
		    String time = scan.next();
		    
		    System.out.print("Production Company: ");
		    String production = scan.next();
		    	
		    System.out.print("Status: ");
		    String status = scan.next();
		    	
			System.out.print("Add More?(Y/N) ");
			option = scan.next().toUpperCase().charAt(0);
			
			System.out.println();
			
			addFilm(code, title, description, language, time, production, status);
			++numberFilm;
		}
	}
	
	public void addFilm(String code, String title, String description, String language, String time, String production, String status){
			films[numberFilm] = new film(code, title, description, language, time, production, status);

	}
	//Search Film Method
	public void searchFilm(){
		Scanner scan = new Scanner(System.in);
		
		System.out.println();
		System.out.println("Search Films");
		System.out.println("============");
		System.out.print("Please Key-in Item Code: ");
		String code = scan.next();
		
		for(int i = 0; i < arrFilms.length; i++)
			if(code == arrFilms[i].getItemCode()){
				System.out.println("Item Code: " + arrFilms[i].getItemCode());
		    	System.out.println("Title: " + arrFilms[i].getTitle());
		    	System.out.println("Description: " + arrFilms[i].getDescription());
		    	System.out.println("Language: " + arrFilms[i].getLanguage());
		    	System.out.println("Running Time: " + arrFilms[i].getRunningTime());
		    	System.out.println("Production Company: " + arrFilms[i].getProductionCompany());
		    	System.out.println("Status: " + arrFilms[i].getStatus());
		    	System.out.println();
			}		
	}
	
}

client program class

import java.util.Scanner;

public class ClientProgram {
    static collection callCollection = new collection();
    static int countFilm = callCollection.numberFilm;
    static collection[] collectionFilms = new collection[countFilm];
    static film[] filmFilms = new film[countFilm];

    public static void main(String[] args){
    	Scanner scanMenu = new Scanner(System.in);
    	boolean condition = false;
    	
    	do{
	    	System.out.println();
	    	System.out.println("Ortsa Sdn. Bhd.");
	    	System.out.println("---------------");
	    	System.out.println("(1) Add New Film");
	    	System.out.println("(2) Search Film");
	    	System.out.println("(3) Amend Film");
	    	System.out.println("(4) Update Film Status");
	    	System.out.println("(5) Listing Films' Details");
	    	System.out.println("(6) Exit The Program");
	    	System.out.println();
	    	System.out.print("What's Your Choice: ");
	    	int scanChoice = scanMenu.nextInt();
	    	
	    	if(scanChoice == 1)
	    		callCollection.inputFilm();
	    		
	    	else if(scanChoice == 2)
	    		callCollection.searchFilm();
	    		
	    	else if(scanChoice == 3)
	    		amendFilm(filmFilms);
	    		
	    	else if(scanChoice == 4)
	    		updateStatus(filmFilms);
	    		
	    	else if(scanChoice == 5)
	    		listingFilm(filmFilms);
	    		
	    	else if(scanChoice == 6)
	    		System.exit(0);
	    		
	    	condition = false;
	    	
	    	char pause = '\u0000';
	    	while(true){
	    		System.out.print("Press Enter Keys To Continue...");
	    		try{
	    			pause = (char)System.in.read();
	    			if(pause != '\u0000')
	    				break;
	    		}catch(java.io.IOException ioexception){
	    			System.out.println(ioexception);
	    		}
	    	}
	    	
    	}while(condition == false);
    }
    
    //Amend Film Method
	public static void amendFilm(film[] filmFilms){
		Scanner scan = new Scanner(System.in);
	
		System.out.println();
		System.out.println("Amend Films' Details");
		System.out.println("====================");
		System.out.print("Please Key-in Item Code: ");
		String code = scan.next();
		
		for(int i = 0; i < collectionFilms.length; i++)
			if(code == filmFilms[i].getItemCode()){
				System.out.print("(0) Amend Item Code");
				System.out.print("(1) Amend Title");
				System.out.print("(2) Amend Description");
				System.out.print("(3) Amend Language");
				System.out.print("(4) Amend Running Time");
				System.out.print("(5) Amend Production Company");
				System.out.print("Selection: ");
				int selection = scan.nextInt();
		
				if(selection == 0){
					System.out.print("Enter New Item Code: ");
					filmFilms[i].setItemCode(scan.next());
				}
				else if(selection == 1){
					System.out.print("Enter New Title: ");
					filmFilms[i].setTitle(scan.next());
				}
				else if(selection == 2){
					System.out.print("Enter New Description: ");
					filmFilms[i].setDescription(scan.next());
				}
				else if(selection == 3){
					System.out.print("Enter New Language: ");
					filmFilms[i].setLanguage(scan.next());
				}
				else if(selection == 4){
					System.out.print("Enter New Running Time: ");
					filmFilms[i].setRunningTime(scan.next());
				}
				else if(selection == 5){
					System.out.print("Enter New Production Company: ");
					filmFilms[i].setProductionCompany(scan.next());
				}
			}
	}
	
	//Update Films' Status Method
	public static void updateStatus(film[] filmFilms){
		Scanner scanStatus = new Scanner(System.in);
		
		System.out.println();
		System.out.println("Status Update");
		System.out.println("=============");

		System.out.print("Enter Item Code: ");
		String code = scanStatus.next();
		
		for(int i = 0; i < collectionFilms.length; i++)
			if(code == filmFilms[i].getItemCode()){
				System.out.print("Enter New Status: ");
				filmFilms[i].setStatus(scanStatus.next());
			}
	}
	
	//Listing All Films' Details
	public static void listingFilm(film[] filmFilms){
		System.out.println();
		System.out.println("Listing Films");
		System.out.println("=============");
		
		int numFilm = 1;
		for(int i = 0; i < collectionFilms.length; i++, numFilm++){
			System.out.println("Film " + numFilm);
			System.out.println("Item Code: " + filmFilms[i].getItemCode());
	    	System.out.println("Title: " + filmFilms[i].getTitle());
	    	System.out.println("Description: " + filmFilms[i].getDescription());
	    	System.out.println("Language: " + filmFilms[i].getLanguage());
	    	System.out.println("Running Time: " + filmFilms[i].getRunningTime());
	    	System.out.println("Production Company: " + filmFilms[i].getProductionCompany());
	    	System.out.println("Status: " + filmFilms[i].getStatus());
	    	System.out.println();
		}
	}
}

what's my problem is when i choose to add film it will go to collection class and run inputFilm method, after i finish input i go to display or amend or search, it won't display anything, where's my mistake?

Comments
This is a prefectly reasonable post that didn't deserve a down vote
Such a big code is posted. Be specific and brief.

I'm a bit baffled by the number of arrays in this program.
I would expect to see the collection class containing just one array of films, not two, and I would not expect to see any other class having any arrays of films or arrays of collections at all.
With all those spare/duplicated arrays it's not surprising that some of your code is coming up empty - it's probably trying to use an array which is not the one with the real data.
My best advice is that you should delete one of the two arrays in collection, and all the arrays in all the other classes. In the main class create one shared instance of collection. Then go through the resulting slew of compiler errors replacing all the references to removed arrays with references to the same one instance of collection.

alright, some of the array is assignment question required.
Collection class - film[] films = new film[100]; (this is required to put on collection) other than this, all is do by ownself.

but how can i get the array from another class file?
the ClientProgram is the Main, in fact i should take all the value from that collection class that array if got add films. :/

I think it would help to start programming classes with Capital Letters. This makes reading the code so much easier:

Film[] films = new Film[100];
	static int numberFilm = 0;
	Film[] arrFilms = new Film[numberFilm];
//...
new Film();

instead of:

film[] films = new film[100];
	static int numberFilm = 0;
	film[] arrFilms = new film[numberFilm];
//...
new film();

but how can i get the array from another class file?
the ClientProgram is the Main, in fact i should take all the value from that collection class that array if got add films. :/

In your main class create an instance of the collection class (not an array!). Use that one instance (and the one array of Films it contains) for everything.

ps. As per the hiddepolen's post it is a helpful convention that Java class names always begin with a capital letter and variables and methods begin with a. lower case letter, but don't change collection to Collection because that's an important class in the Java API. A name like FilmCollection would be ideal.

One more thing... Line 16 in your collection class...

for(char option = 'Y'; option == 'Y';){

What's this for???

okay, i've made the changes

public class collection {
	Film[] films = new Film[100];
	static int numberFilm;
	Film[] arrFilms = new Film[numberFilm];
public class ClientProgram {
    public static void main(String[] args){
    	collection callCollection = new collection();
    	Film[] callFilms = new Film[callCollection.numberFilm];

is this what you mean?
if do so, i can't input due to Arrayoutofbound :/

One more thing... Line 16 in your collection class...

for(char option = 'Y'; option == 'Y';){

What's this for???

This one is to ensure user whether want to continue or not. :)

Hmm... Then you should use a proper loop. A for-loop is not suitable for that kind of checking. You should use do-while in this case.

char option;
do {
  ...  // the whole code in your for-loop
} while (char=='y' || char=='Y');

Before going further (for me), I'm still not sure what you are attempting to do here. What "Film"? What "Collection"? (And actually you should change the class name to "FilmCollection" because the "Collection" already exists in JAVA library.) Does a client has a film collection, and each film has certain number of pictures? Then the client can have more than one film collection?

the class name of collection cannot be change, since question is required to define collection class.
what i want is successful to get user input and store into the array, so when i go to my ClientProgram, i can do any functions, such as Display, Amend, Update and so on. :)

I've misunderstanding the question, lucky my friends remind me, so i made some changes.. all of the collection class in previous posts have been move into the ClientProgram class. all the things are same, but my problem is still the same,
i still can't input into the inputFilm() due to ArrayIndexOutOfBoundException, me and my friends is keep checking where is the misstake, but we still can't find out. :(

/**
 * @(#)ClientProgram.java
 * @Objective = To execute the Program.
 * @Author = Jack Wong Kah Hon & Ng Mhing Shiang
 * @Date =  14 Octoboer 2011
 * @version 1.00 2011/10/14
 */

import java.util.Scanner;

public class ClientProgram {
    Film[] films = new Film[100];
    static int numberFilm;
    static Film[] callFilms = new Film[numberFilm];

    public static void main(String[] args){

    	Scanner scanMenu = new Scanner(System.in);
    	boolean condition = true;

    	do{
	    	System.out.println();
	    	System.out.println("Ortsa Sdn. Bhd.");
	    	System.out.println("---------------");
	    	System.out.println("(1) Add New Film");
	    	System.out.println("(2) Search Film");
	    	System.out.println("(3) Amend Film");
	    	System.out.println("(4) Update Film Status");
	    	System.out.println("(5) Listing Films' Details");
	    	System.out.println("(6) Exit The Program");
	    	System.out.println();
	    	System.out.print("What's Your Choice: ");
	    	int scanChoice = scanMenu.nextInt();

	    	switch(scanChoice){
	    		case 1: inputFilm(); break;
	    		case 2: searchFilm(callFilms); break;
	    		case 3: amendFilm(callFilms); break;
	    		case 4: updateStatus(callFilms); break;
	    		case 5: listingFilm(callFilms); break;
	    		case 6: condition = false; break;
	    		default: System.out.println("You've Entered Invalid Choices!"); break;
	    	}
	    	if(scanChoice != 6){
	    	char pause = '\u0000';
		    	while(true){
		    		System.out.print("Press Enter Keys To Continue...");
		    		try{
		    			pause = (char)System.in.read();
		    			if(pause != '\u0000')
		    				break;
		    		}catch(java.io.IOException ioexception){
		    			System.out.println(ioexception);
		    		}
		    	}
	    	}
    	}while(condition);
   }

	//User Input Film Method
	public static void inputFilm(){
		Scanner scan = new Scanner(System.in);
		char option = 'Y';

		System.out.println();
		System.out.println("Add New Films");
		System.out.println("=============");

		do{
			System.out.print("Item Code: ");
			String code = scan.next();

		    System.out.print("Title: ");
		    String title = scan.next();

		    System.out.print("Description: ");
		    String description = scan.next();

		    System.out.println("Language: (1) English");
		    System.out.println("          (2) Cantonese");
		    System.out.println("          (3) Mandarine");
		    System.out.println("          (4) Malay");
		    System.out.println("          (5) Hindu");
		    System.out.println("          (6) Others");
		    System.out.print("Choose Your Language: ");
		    String language = "";
		    int chooseLanguage = scan.nextInt();
		    switch(chooseLanguage){
		    	case 1: language = "English"; break;
		    	case 2: language = "Cantonese"; break;
		    	case 3: language = "Mandarine"; break;
		    	case 4: language = "Malay"; break;
		    	case 5: language = "Hindu"; break;
		    	case 6: System.out.print("Others: "); language = scan.next(); break;
		    	default: System.out.println("Invalid Selections!"); break;
		    }

		    System.out.print("Running Time(Minutes): ");
		    int time = scan.nextInt();

		    System.out.print("Production Company: ");
		    String production = scan.next();

		    System.out.println("Status: (1) Pending");
		    System.out.println("        (2) Premiering");
		    System.out.println("        (3) Running");
		    System.out.println("        (4) Written-Off");
		    System.out.print("Choose Your Status: ");
		    String status = "";
		    int chooseStatus = scan.nextInt();
		    switch(chooseStatus){
		    	case 1: status = "Pending"; break;
		    	case 2: status = "Premiering" ; break;
		    	case 3: status = "Running"; break;
		    	case 4: status = "Written-Off"; break;
		    	default: System.out.println("Invalid Selections!"); break;
		    }

			addFilm(code, title, description, language, time, production, status);

			System.out.print("Add More?(Y/N) ");
			option = scan.next().toUpperCase().charAt(0);

			System.out.println();

		}while(option == 'Y');
	}

	//Add Film Method
	public static void addFilm(String code, String title, String description, String language, int time, String production, String status){
			callFilms[numberFilm] = new Film(code, title, description, language, time, production, status);
			++numberFilm;
	}

	//Search Film Method
	public static void searchFilm(Film[] callFilms){
		Scanner scan = new Scanner(System.in);

		System.out.println();
		System.out.println("Search Films");
		System.out.println("============");
		System.out.print("Please Key-in Item Code: ");
		String code = scan.next();

		for(int i = 0; i < callFilms.length; i++)
			if(code == callFilms[i].getItemCode()){
				System.out.println();
				System.out.println("Item Code: " + callFilms[i].getItemCode());
		    	System.out.println("Title: " + callFilms[i].getTitle());
		    	System.out.println("Description: " + callFilms[i].getDescription());
		    	System.out.println("Language: " + callFilms[i].getLanguage());
		    	System.out.println("Running Time: " + callFilms[i].getRunningTime());
		    	System.out.println("Production Company: " + callFilms[i].getProductionCompany());
		    	System.out.println("Status: " + callFilms[i].getStatus());
		    	System.out.println();
			}
	}

    //Amend Film Method
	public static void amendFilm(Film[] callFilms){
		Scanner scan = new Scanner(System.in);

		System.out.println();
		System.out.println("Amend Films' Details");
		System.out.println("====================");
		System.out.print("Please Key-in Item Code: ");
		String code = scan.next();

		for(int i = 0; i < callFilms.length; i++)
			if(code == callFilms[i].getItemCode()){
				System.out.print("(0) Amend Item Code");
				System.out.print("(1) Amend Title");
				System.out.print("(2) Amend Description");
				System.out.print("(3) Amend Language");
				System.out.print("(4) Amend Running Time");
				System.out.print("(5) Amend Production Company");
				System.out.print("Selection: ");
				int selection = scan.nextInt();

				if(selection == 0){
					System.out.print("Enter New Item Code: ");
					callFilms[i].setItemCode(scan.next());
				}
				else if(selection == 1){
					System.out.print("Enter New Title: ");
					callFilms[i].setTitle(scan.next());
				}
				else if(selection == 2){
					System.out.print("Enter New Description: ");
					callFilms[i].setDescription(scan.next());
				}
				else if(selection == 3){
					System.out.print("Enter New Language: ");
					callFilms[i].setLanguage(scan.next());
				}
				else if(selection == 4){
					System.out.print("Enter New Running Time: ");
					callFilms[i].setRunningTime(scan.nextInt());
				}
				else if(selection == 5){
					System.out.print("Enter New Production Company: ");
					callFilms[i].setProductionCompany(scan.next());
				}
			}
	}

	//Update Films' Status Method
	public static void updateStatus(Film[] callFilms){
		Scanner scanStatus = new Scanner(System.in);

		System.out.println();
		System.out.println("Status Update");
		System.out.println("=============");

		System.out.print("Enter Item Code: ");
		String code = scanStatus.next();

		for(int i = 0; i < callFilms.length; i++)
			if(code == callFilms[i].getItemCode()){
				System.out.print("Enter New Status: ");
				callFilms[i].setStatus(scanStatus.next());
			}
	}

	//Listing All Films' Details
	public static void listingFilm(Film[] callFilms){
		System.out.println();
		System.out.println("Listing Films");
		System.out.println("=============");

		int numFilm = 1;
		for(int i = 0; i < callFilms.length; i++, numFilm++){
			System.out.println("Film " + numFilm);
			System.out.println("Item Code: " + callFilms[i].getItemCode());
	    	System.out.println("Title: " + callFilms[i].getTitle());
	    	System.out.println("Description: " + callFilms[i].getDescription());
	    	System.out.println("Language: " + callFilms[i].getLanguage());
	    	System.out.println("Running Time: " + callFilms[i].getRunningTime());
	    	System.out.println("Production Company: " + callFilms[i].getProductionCompany());
	    	System.out.println("Status: " + callFilms[i].getStatus());
	    	System.out.println();
		}
	}
}

Line 131, your "time" variable is an integer. In your Film class constructor, there is no "int" type to accept that variable type.

Line 198, you are taking nextInt() which returns an int type. In your Film class, your method accepts a String type. If you want to accept an int type, implement another method with the same name but accept type is int (polymorphism).

Also, why do you need two arrays (

Film[] films = new Film[100];
    static int numberFilm;
    static Film[] callFilms = new Film[numberFilm];

). I think someone has already said that: it doesn't make sense. Could you maybe write down the exact assignment, so we don't have to keep quessing what you are doing?

hmm, just ignore another methods and focus inputFilm and addFilm method. because if i could fixed that problem i could fixed another method problems. :)
and also why i created two arrays? ya, someone has told me but i also said

Film[] films = new Film[100] //questions require to put it
     static int numberFilm;
     static Film[] callFilms = new Film[numberFilm]
     //these two lines is used to get how many films i got, so when i do any others methods' looping is won't loop 100 times

here is the new Film class file after i modified, sorry i didn't update it.

/**
 * @(#)Film.java
 * @Objective = To help Ortsa Sdn. Bhd to develop an application to keep track of all films (movies)
 * @Author = Jack Wong Kah Hon & Ng Mhing Shiang
 * @Date =  14 Octoboer 2011
 * @version 1.00 2011/10/14
 */

import java.util.Scanner;

// Creating Class Members
public class Film {
	private	String itemCode;
	private	String title;
	private	String description;
	private	String language;
	private	int runningTime;
	private	String productionCompany;
	private	String status; //eg, pending, premiering, running, written-off

    // No-argument Constructor: Without Parameters
    public Film() {
    	itemCode = null;
    	title = null;
    	description = null;
    	language = null;
    	runningTime = 0;
    	productionCompany = null;
    	status = null;
    }

    // With Argument Constructor: With Parameters
    public Film(String itemCode, String title, String description, String language, int runningTime, String productionCompany, String status){
    	this.itemCode = itemCode;
    	this.title = title;
    	this.description = description;
    	this.language = language;
    	this.runningTime = runningTime;
    	this.productionCompany = productionCompany;
    	this.status = status;
    }

    //Copy Constructor
    public Film(Film films){
		itemCode = films.itemCode;
    	title = films.title;
    	description = films.description;
    	language = films.language;
    	runningTime = films.runningTime;
    	productionCompany = films.productionCompany;
    	status = films.status;
    }

    //Setter & Getter Method, From: itemCode - status
    public void setItemCode(String itemCode){
    	this.itemCode = itemCode;
    }
    public String getItemCode(){
    	return itemCode;
    }

    public void setTitle(String title){
    	this.title = title;
    }
    public String getTitle(){
    	return title;
    }

    public void setDescription(String description){
    	this.description = description;
    }
    public String getDescription(){
    	return description;
    }

    public void setLanguage(String language){
    	this.language = language;
    }
    public String getLanguage(){
    	return language;
    }

    public void setRunningTime(int runningTime){
    	this.runningTime = runningTime;
    }
    public int getRunningTime(){
    	return runningTime;
    }

    public void setProductionCompany(String productionCompany){
    	this.productionCompany = productionCompany;
    }
    public String getProductionCompany(){
    	return productionCompany;
    }

    public void setStatus(String status){
    	this.status = status;
    }
    public String getStatus(){
    	return status;
    }

    //Method equals that return true if two objects contain the same information
    public static boolean equals(Film firstFilm, Film secondFilm){
    	if(firstFilm.getItemCode().equals(secondFilm.getItemCode()) && firstFilm.getTitle().equals(secondFilm.getTitle()) &&
    		firstFilm.getDescription().equals(secondFilm.getDescription()) && firstFilm.getLanguage().equals(secondFilm.getLanguage()) &&
    		(firstFilm.getRunningTime() == secondFilm.getRunningTime()) && firstFilm.getProductionCompany().equals(secondFilm.getProductionCompany()) &&
    		firstFilm.getStatus().equals(secondFilm.getStatus()))
    		return true;
    	else
    		return false;
    }
}

and focus on inputFilm() and addFilm()

/**
 * @(#)ClientProgram.java
 * @Objective = To execute the Program.
 * @Author = Jack Wong Kah Hon & Ng Mhing Shiang
 * @Date =  14 Octoboer 2011
 * @version 1.00 2011/10/14
 */

import java.util.Scanner;

public class ClientProgram {
    Film[] films = new Film[100];
    static int numberFilm;
    static Film[] callFilms = new Film[numberFilm];

    public static void main(String[] args){

    	Scanner scanMenu = new Scanner(System.in);
    	boolean condition = true;

    	do{
	    	System.out.println();
	    	System.out.println("Ortsa Sdn. Bhd.");
	    	System.out.println("---------------");
	    	System.out.println("(1) Add New Film");
	    	System.out.println("(2) Search Film");
	    	System.out.println("(3) Amend Film");
	    	System.out.println("(4) Update Film Status");
	    	System.out.println("(5) Listing Films' Details");
	    	System.out.println("(6) Exit The Program");
	    	System.out.println();
	    	System.out.print("What's Your Choice: ");
	    	int scanChoice = scanMenu.nextInt();

	    	switch(scanChoice){
	    		case 1: inputFilm(); break;
	    		case 2: searchFilm(callFilms); break;
	    		case 3: amendFilm(callFilms); break;
	    		case 4: updateStatus(callFilms); break;
	    		case 5: listingFilm(callFilms); break;
	    		case 6: condition = false; break;
	    		default: System.out.println("You've Entered Invalid Choices!"); break;
	    	}
	    	// To perform "Pause" function
	    	if(scanChoice != 6){
	    	char pause = '\u0000';
		    	while(true){
		    		System.out.print("Press Enter Keys To Continue...");
		    		try{
		    			pause = (char)System.in.read();
		    			if(pause != '\u0000')
		    				break;
		    		}catch(java.io.IOException ioexception){
		    			System.out.println(ioexception);
		    		}
		    	}
	    	}
    	}while(condition);
   }

	//User Input Film Method
	public static void inputFilm(){
		Scanner scan = new Scanner(System.in);
		char option = 'Y';

		System.out.println();
		System.out.println("Add New Films");
		System.out.println("=============");

		do{
			System.out.print("Item Code: ");
			String code = scan.next();

		    System.out.print("Title: ");
		    String title = scan.next();

		    System.out.print("Description: ");
		    String description = scan.next();

		    System.out.println("Language: (1) English");
		    System.out.println("          (2) Cantonese");
		    System.out.println("          (3) Mandarine");
		    System.out.println("          (4) Malay");
		    System.out.println("          (5) Hindu");
		    System.out.println("          (6) Others");
		    System.out.print("Choose Your Language: ");
		    String language = "";
		    int chooseLanguage = scan.nextInt();
		    switch(chooseLanguage){
		    	case 1: language = "English"; break;
		    	case 2: language = "Cantonese"; break;
		    	case 3: language = "Mandarine"; break;
		    	case 4: language = "Malay"; break;
		    	case 5: language = "Hindu"; break;
		    	case 6: System.out.print("Other Languages: "); language = scan.next(); break;
		    	default: System.out.println("Invalid Selections!"); break;
		    }

		    System.out.print("Running Time(Minutes): ");
		    int time = scan.nextInt();

		    System.out.print("Production Company: ");
		    String production = scan.next();

		    System.out.println("Status: (1) Pending");
		    System.out.println("        (2) Premiering");
		    System.out.println("        (3) Running");
		    System.out.println("        (4) Written-Off");
		    System.out.print("Choose Your Status: ");
		    String status = "";
		    int chooseStatus = scan.nextInt();
		    switch(chooseStatus){
		    	case 1: status = "Pending"; break;
		    	case 2: status = "Premiering" ; break;
		    	case 3: status = "Running"; break;
		    	case 4: status = "Written-Off"; break;
		    	default: System.out.println("Invalid Selections!"); break;
		    }

			addFilm(code, title, description, language, time, production, status);

			System.out.print("Add More?(Y/N) ");
			option = scan.next().toUpperCase().charAt(0);

			System.out.println();

		}while(option == 'Y');
	}

	//Add Film Method
	public static void addFilm(String code, String title, String description, String language, int time, String production, String status){
			callFilms[numberFilm] = new Film(code, title, description, language, time, production, status);
			++numberFilm;
	}

You have moved the arrays into ClientProgram. This makes the "collection" class pointless and is definitely a design mistake.
You application should contain exactly ONE array of Films, and that should be in the collection class. Every version of the code you post seems to contain at least two or three arrays so nobody (including you) ever knows which one has what data, and which one to use. One last time: exactly ONE array in the whole application.
In your ClientProgram class create an instance of the collection class. Use that one instance (and the one array of Films it contains) for everything.

but as my lecturer said, if the varible doesn't initialize also is equal to 0;
i cannot do in one array, since the assignment question require us to define an array with size 100, so i use numberFilm to detect how many films they have, so it won't looping for 100 times instead of looping the value of numberFilm.

As other said, you have come design flaw. I think it is from misunderstanding the requirement.

1)In your Film in equals() method line 105~113, is the requirement said that you need to implement a static method for comparison? Normally, equals() method is for itself with another instance. In your way, you take 2 instances to compare?

2)In your ClientProgram line 14, you do not need a static Film array (collection). What you need is line 12 "Film" array. If you do not want to use that name "films" then you could change it to your "callFilms" instead. However, you do not need line 14.

3)Your codes don't seem to be wrong, so what's wrong???

but as my lecturer said, if the varible doesn't initialize also is equal to 0;

It is true that the value is 0, but you cannot use it. It is also wrong not to initialize it, because of the readability of your code. Just always initialize a variable, even with 0. Else, the program will not compile or there will be errors later on.

i cannot do in one array, since the assignment question require us to define an array with size 100, so i use numberFilm to detect how many films they have, so it won't looping for 100 times instead of looping the value of numberFilm.

Yes, you can:

public class ClientProgram {
    Film[] films = new Film[100];
    static int numberFilm;
// ...

public void someMethodWithForLoop () {
for (int i=0; i<numberFilm; i++) {
doSomethingWithTheFilm (films[i]);
}
}
public void addFilm(Film f) {
//...
if (numberFilms < 100) {
films[numberFilms++] = f; // I add one to the number of films, AFTER the addition of the film to the array.
}
else {
System.out.println("Error, too many films");
}
//...
}
}

Easier would be:

public class ClientProgram {
    ArrayList<Film> films= new ArrayList<Film>();
// ...

public void someMethodWithForLoop () {
for (int i=0; i<films.size(); i++) {
doSomethingWithTheFilm (films.get(i));
}
}
// or, even better: 
public void someMethodWithForLoop () {
for (Film f: films) {
doSomethingWithTheFilm (f);
}
}
public void addFilm(Film f) {
//...
films.add(f);
//...
}
}

ArrayLists are underestimated, they are very useful, because of their variable size. Try a little, and you will see yourself.

Edited 5 Years Ago by hiddepolen: n/a

It's true that any experienced Java developer would use ArrayList here, not an array, but the OP's task has been defined by his instructor, and he has to use an array. :-(

Was the actual assignment to use an array? Please write down the exact assignment, so that we can help you better.

Anyway, it is still possible to have only one array, and keeping a static int with the number of films in the array. You can loop through that, like I did in my code.

awh, finally i got that solutions.
i want to ask, in every program we do, one type of array cannot be called twice or declare twice?
and in string compare, we cannot use "==" instead of using .equals method? and .equals is a set?

Yes, you can declare array on the same class. However, you do not need 2 of the arrays in this class.

Yes and no. Yes that you need to use equals() method to deal with comparing objects. Using "==" will compare the object references which would never be the same if you are comparing 2 different objects. You could, however, use "==" to compare primitive type, such as int, long, float, double, char, and boolean. The equals() method is a member method of Object class (if I remember correctly) which may or may not need to be overridden. If you do override, you may also have to override HashCode() method as well... That would be too deep for now, so I will leave it for the future.

Edited 5 Years Ago by Taywin: n/a

oh, i see. anyways thanks for helping :):) my assignment part 2 is coming soon after i hand up this assignment part 1. i think i still needed you all help. :)
by the way, i also modify my inputFilm() and addFilm(), purpose is to check whether got duplicate data or not, if true then ask the user to retype whole thing again with the current array size, if false then will go assign into the callFilms, but i've no ideas to do it, can give me some idea?

//User Input Film Method
	public static void inputFilm(Film[] callFilms){
		Scanner scan = new Scanner(System.in);
		char option = 'Y';

		System.out.println();
		System.out.println("Add New Films");
		System.out.println("=============");

		do{
			System.out.print("Item Code: ");
			String code = scan.next();

		    System.out.print("Title: ");
		    String title = scan.next();

		    System.out.print("Description: ");
		    String description = scan.next();

		    System.out.println("Language: (1) English");
		    System.out.println("          (2) Cantonese");
		    System.out.println("          (3) Mandarine");
		    System.out.println("          (4) Malay");
		    System.out.println("          (5) Hindu");
		    System.out.println("          (6) Others");
		    System.out.print("Choose Your Language: ");
		    String language = "";
		    int chooseLanguage = scan.nextInt();
		    switch(chooseLanguage){
		    	case 1: language = "English"; break;
		    	case 2: language = "Cantonese"; break;
		    	case 3: language = "Mandarine"; break;
		    	case 4: language = "Malay"; break;
		    	case 5: language = "Hindu"; break;
		    	case 6: System.out.print("Other Languages: "); language = scan.next(); break;
		    	default: System.out.println("Invalid Selections!"); break;
		    }

		    System.out.print("Running Time(Minutes): ");
		    int time = scan.nextInt();

		    System.out.print("Production Company: ");
		    String production = scan.next();

		    System.out.println("Status: (1) Pending");
		    System.out.println("        (2) Premiering");
		    System.out.println("        (3) Running");
		    System.out.println("        (4) Written-Off");
		    System.out.print("Choose Your Status: ");
		    String status = "";
		    int chooseStatus = scan.nextInt();
		    switch(chooseStatus){
		    	case 1: status = "Pending"; break;
		    	case 2: status = "Premiering" ; break;
		    	case 3: status = "Running"; break;
		    	case 4: status = "Written-Off"; break;
		    	default: System.out.println("Invalid Selections!"); break;
		    }
		    
			addFilm(code, title, description, language, time, production, status, callFilms);

			System.out.print("Add More?(Y/N) ");
			option = scan.next().toUpperCase().charAt(0);

			System.out.println();

		}while(option == 'Y');
	}

	//Add Film Method
	public static void addFilm(String code, String title, String description, String language, int time, String production, String status, Film[] callFilms){
		if(numberFilm == 0){
			callFilms[numberFilm] = new Film(code, title, description, language, time, production, status);
			++numberFilm;
		}
		else{
			boolean resultCheck = checkFilm(callFilms);
			if(resultCheck == true){
				callFilms[numberFilm] = new Film(code, title, description, language, time, production, status);
				++numberFilm;
			}
			else
				System.out.println("Duplicate Data. :(");
		}
	}

	public static boolean checkFilm(Film[] callFilms){
		int x = 1;
		boolean check = true;
		for(int i = 0; i < numberFilm; i++, x++){
			if(callFilms[x] == callFilms[i])
				check = true;
			else
				check = false;
		}
		return check;
	}
public static boolean checkFilm(Film[] callFilms){
		int x = 1;
		boolean check = true;
		for(int i = 0; i < numberFilm; i++, x++){
			if(callFilms[x] == callFilms[i])
				check = true;
			else
				check = false;
		}
		return check;
	}

I see what you are trying to do here, but you should use the .equals() method. Two different objects, even with the same data will never return true if you compare them using ==. The reason for this is that you are comparing the locations of the two objects, not the objects themselves.

Also, the program is going to crash because of an ArrayOutOfBoundsException. callFilms[x], when x is always 1 bigger then i: x will be numberFilms when i is numberFilms-1. This will crash, because the max of callFilms is numberFilms-1. Add a check next to i < numberFilm for x < numberFilms.

What I don't understand, is that you only compare the last two entries in the array, and return that value. Do you want to:
- Only check the last two?
- Check if any films match?

If you only want to check the last two, why loop through the entire array? Else, why do you update the same variable on every run of the loop?

i am not check only last two, i am check the whole array. :)
just check whether the new input is duplicate or not. :)

You ARE only checking the last two.

- loop starts
- first check, x=1, i=0
- not equal, boolean is false
- second check, x=2, i=1
- duplicate found! boolean is true
- third check x=3, i=2
- not equal, boolean is false
- loop ends
- return, false, even though there was one duplicate

If you really only want to check the duplicate addition, loop through the array, and compare the current object:

public static boolean checkFilm(Film[] callFilms){
		Film addedFilm = callFilms [numberFilms-1];
		boolean check = false;
		for(int i = 0; i < numberFilm-1; i++, x++){ // note the numberFilm-1!
if (callFilms[i].equals(addedFilm)) // I am using .equals()
check = true; // if there is any match, the boolean is true. Else, don't do anything
		}
		return check;
	}

Edited 5 Years Ago by hiddepolen: n/a

This question has already been answered. Start a new discussion instead.