Advertisement
oona

film ratings

Mar 17th, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.37 KB | None | 0 0
  1.  
  2. public class filmRatings {
  3.  
  4.     public static void main(String[] args) {
  5.         // TODO Auto-generated method stub
  6.        
  7.         String films [] = {"Titanic", "Mr. Popper's Penguins", "2001: A Space Odyssey", "Funny Face", "Indiana Jones and the Raiders of the Lost Ark", "Water for Elephants", "One Flew Over the Cuckoo's Nest", "Twilight: New Moon", "Hotel Transylvania", "The Life and Death of Peter Sellers"};
  8.         String director [] = {"James Cameron", "Mark Waters", "Stanley Kubrick", "Stanley Donen", "Steven Spielberg", "Francis Lawrence", "Milos Forman", "Chris Weitz", "Genndy Tartakovsky", "Stephen Hopkins"};
  9.         String releaseYear [] = {"1997", "2011", "1968", "1957", "1981", "2011", "1975", "2009", "2012", "2004"};
  10.         int score [] = {10, 4, 5, 7, 8, 8, 4, 2, 4, 9};
  11.        
  12.         rating(films, director, releaseYear, score);
  13.  
  14.     } //main ends here
  15.    
  16.     static void rating(String[] films, String[] director, String[] releaseYear, int[] score)
  17.     {
  18.         for(int i=0; i<score.length; i++)
  19.         {
  20.             if(score[i]<5)
  21.             {
  22.                 System.out.println(films[i] + " by " + director[i] + ", " + releaseYear[i] + ". Rating: " + score[i] + "/10. A bad lame film never to be seen again");
  23.             }
  24.             else if(score[i]>=5)
  25.             {
  26.                 System.out.println(films[i] + " by " + director[i] + ", " + releaseYear[i] + ". Rating: " + score[i] + "/10. A great film that should be seen more than once");
  27.             }
  28.         }
  29.     }
  30.  
  31. } //class ends here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement