I cannot work out why both entries are the same: Also can I enter the information by using:
movie(title, released, certificate, description, rating, genre)
package test; public class TEST { public String movie_title="NA"; public int movie_released=0000; public String movie_certificate="NA"; public String movie_description="BLANK"; public double movie_rating=0.0; public String movie_genre="MOVIE"; public static void main(String[] args) { int position = 0; TEST movie = new TEST(); TEST MM[] = new TEST[2]; movie.movie_title="TEST"; movie.movie_released=1992; movie.movie_certificate="PG"; movie.movie_description="Two people fall in love."; movie.movie_rating=10.0; movie.movie_genre="Chick Flick"; MM[position]=movie; position++; movie.movie_title="Sneak and Stab"; movie.movie_released=2001; movie.movie_certificate="18"; movie.movie_description="Two people fall in hate."; movie.movie_rating=0.0; movie.movie_genre="Gore Flick"; MM[position]=movie; //position++; int length = position; for(int Counter=0;Counter<=length;Counter++){ System.out.println("\n\tMovie Record: " +Counter); System.out.println(MM[Counter].movie_title); System.out.println(MM[Counter].movie_released); System.out.println(MM[Counter].movie_certificate); System.out.println(MM[Counter].movie_description); System.out.println(MM[Counter].movie_rating); System.out.println(MM[Counter].movie_genre); } } }
The output looks like this:
Movie Record: 0 Sneak and Stab 2001 18 Two people fall in hate. 0.0 Gore Flick Movie Record: 1 Sneak and Stab 2001 18 Two people fall in hate. 0.0 Gore Flick