Advertisement
Guest User

Filmography.java

a guest
Nov 19th, 2019
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.90 KB | None | 0 0
  1. public class Filmography {
  2.     public static void main(String[] args) {
  3.  
  4.         int k = 0;
  5.  
  6.         // film list
  7.         String[] films = {"Raiders of the Lost Ark (1981)", "Indiana Jones and the Temple of Doom (1984)", "Indiana Jones and the Last Crusade (1989)"};
  8.  
  9.         // actors list
  10.         String[][] filmActors = {{"Harrison Ford", "Karen Allen", "Paul Freeman"},
  11.             {"Harrison Ford", "Kate Capshaw", "Ke Huy Quan"},
  12.             {"Harrison Ford", "Sean Connery", "Denholm Elliott"}
  13.         };
  14.  
  15.         // print headline
  16.         System.out.println("movies and actors: ");
  17.  
  18.  
  19.         // print result
  20.         for (int i = 0; i < films.length; i++) {
  21.             System.out.print("In the movie " + films[i] + ", the main actors are: ");
  22.  
  23.             for (int j = 0; j < filmActors[i].length; j++) {
  24.                 System.out.print(filmActors[i][j]);
  25.  
  26.  
  27.                 if (j < (filmActors[i].length - 1)) {
  28.                     System.out.print(", ");
  29.                 } else {
  30.                     System.out.println(".");
  31.                 }
  32.             }
  33.         }
  34.  
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement