I have an array movieScedule
that include object Movie. In this movie object I have the price of the ticket.
Now I want to create a method that shows the most expensive ticket for the movie.
The method:
public Movie mostExpensive()
{
....
....
....
}
Now I was thinking to create new movie object inside this method
and then for loop to run all over the movies in the array
and then another for loop to run from index 0 all over the movies and check each movie price by using getMoviePrice()
method
In the end I wanted to declare the object movie that I created inside this method as the highest moviePrice
and then return (the movie)
Any idea? Maybe there is a better way?