Hi, I had posted this question before and I did appreciate the response I got. However I still need some little help as:
1.In the addMovieGoers method check that every member of the collection is a human and that they are old enough to watch the movie, if not throw an exception. Note that although the family has getMovieGoers method, you can't be sure it was used to build the collection.
2.Finally add another static method to the cinema class that demonstrates the usage of the cinema class. Include multiple scenarios to show how the exceptions work.-you did not include multiple scenarios

How Do I achieve the two conditions above?

the code is as:

//Cinema class

import java.util.*;
public class Cinema 
{
    float cost;
    String Title;
    
     //Movie class
    private static Movie movieNew = new Movie();
    private static ArrayList<Human> hm = new ArrayList();
    
    public Cinema()
    {
        
    }
    public Cinema (String mtitle, float pounds) 
    {
            this.Title=mtitle;
            this.cost = pounds;
    }

    public float getcost (int people) 
    {
        return cost * people;
    }
       
    /**
    * Method check that the movie title and rating have been set,
    * if not throw MoviePropertiesNotSetException.
    */
    public  void setMovie(Movie movieNew) throws MoviePropertiesNotSetException
    { 
        if(movieNew.getTitle()!=null && movieNew.getRating()!=null)       
        {
             System.out.println("The movie is called " +movieNew.getTitle()+ 
                    " and is rated " +movieNew.getRating()+ ".");                  
        }
        else
        {
            throw new MoviePropertiesNotSetException("The Movie properties not set");
        }
    }
    /**
    * Method check that the movie title and rating have been set,
    * if not throw MoviePropertiesNotSetException.
    */
    public void showMovie() throws MoviePropertiesNotSetException
    { 
        if ((movieNew!=null) && (movieNew.getTitle()!=null) && (movieNew.getRating()!=null))
        {
             System.out.println("Showing... "+movieNew.getTitle());             
        }
        else
        {
            throw new MoviePropertiesNotSetException ("The  movie properties are not set.");
        }                  
    }
     /**Checks if Movie properties are set, if not throws MyException
      * takes a collection (ArrayList) of Human - Adult and Child
      * and checks whether they're old enough to watch a movie using
      * the canWatchMovie() method in Adult and Child class.
      */    
    public void addMovieGoers(ArrayList<Human> hm) throws MoviePropertiesNotSetException,IllegalAgeException
    {            
        if(movieNew.getRating()!=null && movieNew.getTitle()!=null)
        {
            String mRt = movieNew.getRating();
             /**
              * Movie rated PG
              */
             if(movieNew.getRating().equalsIgnoreCase("pg")) 
             {                        
                System.out.println("Movie Goers are::");
                for(int i = 0; i < hm.size(); i++)
                {
                    Human test = (Human)hm.get(i);                   
                    if ( test.canWatchMovie(mRt))    
                    {                        
                        System.out.println(test);  
                    }
                    else
                    {
                        throw new IllegalAgeException("The rest are of Illegal Age!");
                    }                     
                 }
            }
              /**
              * Movie rated A 
              */
            else if(movieNew.getRating().equalsIgnoreCase("a")) 
            {
                System.out.println("Movie goers are: ");
                for ( int i = 0; i < hm.size(); i++)
                {
                    Human test = (Human)hm.get(i);
                    if ( test.canWatchMovie(mRt))  
                    {                        
                         System.out.println(test);  
                    }
                    else
                    {
                       throw new IllegalAgeException("The rest are of Illegal Age!");
                    }
                }
            }            
             /**
              * Movie rated G
              */
            else if(movieNew.getRating().equalsIgnoreCase("g")) 
            { 
                System.out.println("Movie goers are: ");
                for ( int i = 0; i < hm.size(); i++)
                {
                    Human test = (Human)hm.get(i);
                    if ( test.canWatchMovie(mRt)) 
                    {
                        System.out.println(test);
                    }
                    else
                    {
                         System.out.println("The rest are below required age.");
                    }
                }
            }
             /**
              * Throw Exception should the movie properties be missing
              */
            else
            {
                throw new MoviePropertiesNotSetException("The movie properties are not set");
            }
        }         
    }
    public static void main(String args[]) throws MoviePropertiesNotSetException, IllegalAgeException
    { 
        Cinema cn = new Cinema();            
        try
        {
            Human a = new Adult("Joe",43);
            Human b = new Adult("Sue",39);
            Human c = new Adult("Tracy",20);
            Human d = new Child("Sammy",17);
            Human e = new Child("Julie",12);
            Human f = new Child("Mona",4);
            hm.add(a);hm.add(b);hm.add(c);hm.add(d);
            hm.add(e);hm.add(f);
            hm.trimToSize();
           
             //setting properties to the movie 
            movieNew.setName("Comedy");
            movieNew.setRating("G");
            movieNew.setTitle("Mr Bin");
          
            cn.setMovie(movieNew);            
            cn.showMovie();  
            cn.addMovieGoers(hm);
        }
        catch(MoviePropertiesNotSetException exp)
        {
            System.out.println(exp.getMessage());
        }
        catch(IllegalAgeException msg)
        {
            System.out.println(msg.getMessage());
        }
        finally
        {
            System.out.println("Movie is over! Have a good day.");
            movieNew=null;
            cn=null;
        }
    }
}

Regarding requirement 1, not too sure exactly what the issue is, and I am not too sure what the family class looks like. Your conditions are also redundant (you are checking the same condition for each case, so you don't really need to divide these out).

Regarding the second requirement, it seems you already have 1 scenario, so just add more.

Hope that helps

Regarding the second requirement, it seems you already have 1 scenario, so just add more

How do I add more scenarios? does it mean adding another try catch block?

Well yes you would probably end up needing another try / catch block. Keep in mind though, a scenario is like a story.

To test some other cases, perhaps have a movie where ALL the humans watch the movie, and one where NONE watch the movie.

Does that make sense?

To test some other cases, perhaps have a movie where ALL the humans watch the movie, and one where NONE watch the movie.

Is this correct, as in, I've three different try catch block to show three different scenarios. Or is there a shorter way of doing it?

public static void main(String args[]) throws MoviePropertiesNotSetException, IllegalAgeException
    { 
        Cinema cn = new Cinema();  
        Human a = new Adult("Joe",43);
        Human b = new Adult("Sue",39);
        Human c = new Adult("Tracy",20);
        Human d = new Child("Sammy",17);
        Human e = new Child("Julie",12);
        Human f = new Child("Mona",4);
        hm.add(a);hm.add(b);hm.add(c);hm.add(d);
        hm.add(e);hm.add(f);
        hm.trimToSize();
        
        //scenario 1: Movie rated G
        try
        {                
             //setting properties to the movie 
            movieNew.setName("Comedy");
            movieNew.setRating("G");
            movieNew.setTitle("Mr Bin");
          
            cn.setMovie(movieNew);            
            cn.showMovie();  
            cn.addMovieGoers(hm);
        }
        catch(MoviePropertiesNotSetException exp)
        {
            System.out.println(exp.getMessage());
        }
        catch(IllegalAgeException msg)
        {
            System.out.println(msg.getMessage());
        }

        //Scenario 2: Movie rated PG
        try
        {           
             //setting properties to the movie 
            movieNew.setName("Action");
            movieNew.setRating("PG");
            movieNew.setTitle("The Fugitive");
          
            cn.setMovie(movieNew);            
            cn.showMovie();  
            cn.addMovieGoers(hm);
        }
        catch(MoviePropertiesNotSetException exp)
        {
            System.out.println(exp.getMessage());
        }
        catch(IllegalAgeException msg)
        {
            System.out.println("Exception "+msg.getMessage());
        }
        
        //Scenario 3: Movie Rated A
        try
        {            
            //setting properties to the movie 
            movieNew.setName("Action");
            movieNew.setRating("A");
            movieNew.setTitle("Lost in The Woods");
            
            cn.setMovie(movieNew);            
            cn.showMovie();  
            cn.addMovieGoers(hm);
            
        }
        catch(MoviePropertiesNotSetException exp)
        {
            System.out.println("Movie properties missing: "+exp.getMessage());
        }
        catch(IllegalAgeException msg)
        {
            System.out.println("Exception "+msg.getMessage());
        }
         finally
        {
            System.out.println("Movie is over! Have a good day.");
            movieNew=null;
            cn=null;
        }                
    }

I would take that as three scenarios. Is there a shorter way? Most likely, but I wouldn't think that is the aim here, and I wouldn't be the best person to try optimise your code.

Perhaps somebody else can help you there...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.