I am trying to make a movie database for some homework. Getting stuck adding deleting functionality. I get stuck trying when trying to re-add another movie because of my moivecount variable. If I delete movie3 if I have 4 movies then moviecount == 3 and when I try to add another movie it asks for movie4 again when I need to add movie3.

```
import java.util.*;
public class Interface {
private void run() 
{

    Scanner console = new Scanner(System.in);
    Movie m1;
    Movie m2;
    Movie m3;
    Movie m4;

    String name, director;
    int size, duration, option;
    int moviecount = 0;

    m1 = new Movie();
    m2 = new Movie();
    m3 = new Movie();
    m4 = new Movie();

do {
    System.out.println("Import new movie:(0), Delete movie from Database (2), View Movies: (3),  Exit (9): ");
    option = console.nextInt();
    switch(option)
    {
        case 0: 
        if(moviecount == 0)
        {
                System.out.print("First Movie: ");
                name = console.next();
                m1.setName (name);
                System.out.print("Director: ");
                director = console.next();
                m1.setDirector (director);
                System.out.print("Size in MB: ");
                size = console.nextInt();
                m1.setSize(size);
                System.out.print("Duration in minutes: ");
                duration = console.nextInt();
                m1.setDuration(duration);
                moviecount++;
                break;

        }

        else if(moviecount == 1)
        {
                System.out.print("Second Movie: ");
                name = console.next();
                m2.setName (name);
                System.out.print("Director: ");
                director = console.next();
                m2.setDirector (director);
                System.out.print("Size in MB: ");
                size = console.nextInt();
                m2.setSize(size);
                System.out.print("Duration in minutes: ");
                duration = console.nextInt();
                m2.setDuration(duration);
                moviecount++;
                break;
        }

        else  if(moviecount == 2)
        {
                System.out.print("Third Movie: ");
                name = console.next();
                m3.setName (name);
                System.out.print("Director: ");
                director = console.next();
                m3.setDirector (director);
                System.out.print("Size in MB: ");
                size = console.nextInt();
                m3.setSize(size);
                System.out.print("Duration in minutes: ");
                duration = console.nextInt();
                m3.setDuration(duration);
                moviecount++;
                break;
        }

        else  if(moviecount == 3)
        {
                System.out.print("Fourth Movie: ");
                name = console.next();
                m4.setName (name);
                System.out.print("Director: ");
                director = console.next();
                m4.setDirector (director);
                System.out.print("Size in MB: ");
                size = console.nextInt();
                m4.setSize(size);
                System.out.print("Duration in minutes: ");
                duration = console.nextInt();
                m4.setDuration(duration);
                moviecount++;
                break;
        }

        else
        {
                System.out.print("Too many movies currently stored \n" );
                break;
        }

        case 2: System.out.print("Which movie to delete? (1), (2), (3), (4) \n");
        option = console.nextInt();
        switch(option)
        {
           case 1:  m1.setName(null);
                    m1.setDirector(null);
                    m1.setSize(0);
                    m1.setDuration(0);
                    System.out.print("Movie 1 deleted! ");
                    moviecount--;
                    break;           

           case 2:  m2.setName(null);
                    m2.setDirector(null);
                    m2.setSize(0);
                    m2.setDuration(0);
                    moviecount--;
                    break;

           case 3:  m3.setName(null);
                    m3.setDirector(null);
                    m3.setSize(0);
                    m3.setDuration(0);
                    moviecount--;
                    break;

           case 4:  m4.setName(null);
                    m4.setDirector(null);
                    m4.setSize(0);
                    m4.setDuration(0);
                    moviecount--;
                    break;

        }

        case 3: System.out.print("Movies stored in database: \n");
                System.out.print(m1.getName()+"\n"); 
                System.out.print(m2.getName()+"\n");
                System.out.print(m3.getName()+"\n");
                System.out.print(m4.getName()+"\n");

    } 
}
    while(option!=9);

}
public static void main(String[] args){
Interface intFace = new Interface();
intFace.run();
}
}

```