объясняет, как их сравнить.

му я новичок в обработке, и в основном я делаю программу, которая при запуске открывает окно с 4 разными изображениями, каждое из которых имеет описание внизу. В описанных ниже методах я создал два случайных метода: один для количества рецензий, а другой для комментариев рецензии. Я бы хотел, чтобы комментарии не генерировались постоянно для каждого фильма - больше похоже на случайное всплывающее окно, потому что оно тоже вызывает много хаоса, пытаясь прочитать их все. Также, чтобы проверить погоду, я могу добавить массивы строки и целого числа для среднего значения номера обзора.

Ниже приведен код, буду признателен за вашу помощь. Благодарю.

import g4p_controls.*;
import ddf.minim.*;

PFont font;
PImage img1,img2; // background images for two different windows
PImage fimg1, fimg2, fimg3, fimg4, fimg5, fimg6; //images of movies
int rectX,rectY;

GButton btn;
GWindow window;

Minim minim;
AudioPlayer player;

String[] rev_film1 = {"The Best Wolverine Movie","Logan is another level","Disappointment","Such a sad farewell"}; //Logan
String[] rev_film2 = {"A scary movie that isn't scary.","Terrifyingly brilliant.","The perfect blend of comedy and horror","The IT Factor"}; //IT
String[] rev_film3 = {"Soul-less,Confused,Loud.","Devastatingly Disappointed","A technical masterpiece","A visual wonder that lacks depth"}; //Dunkirk
String[] rev_film4 = {"Disgrace", "Worst Star Wars movie", "TERRIBLE","A Betrayal to the Legacy"}; //Starwars


int[] rat_film1 = {9,8,2,2}; 


float r;

void setup()
{
  size(1150,600,JAVA2D);
  surface.setTitle(" - The Theatre of Dreams Database - ");
  font = loadFont("BerlinSansFB-Reg-48.vlw");
  img1 = loadImage("film2.jpg");
  background(img1);

  btn = new GButton(this,900,350,100,50, "Enter Website");

  minim = new Minim(this);
  player = minim.loadFile("sound.mp3");
  player.play();
}

void draw()
{
  fill(255);
  textFont(font,32);
  text("Welcome to", 850, 85);
  text("The Theatre of Dreams", 760, 175);
  text("Database", 870, 220);
}

void handleButtonEvents(GButton button, GEvent event) 
{
  if (button == btn && event == GEvent.CLICKED) 
  {
    createWindow();
    btn.setEnabled(false);
  }
}

void createWindow() // creating new window with mouse click
{
  window =  GWindow.getWindow(this, " - Top 4 Movies in 2017 - ", 100, 50, 1150, 600, JAVA2D);
  window.addDrawHandler(this, "windowDraw");
  window.addOnCloseHandler(this, "windowClosing"); 
  window.setActionOnClose(GWindow.CLOSE_WINDOW);
}

void windowDraw(PApplet app, GWinData data)
{
  img2 = loadImage("film3.jpg");
  app.background(img2);

  app.text(" - Top 4 Movies in 2017 - ",440,85);
  app.fill(255);
  app.textFont(font,25);

  fimg1 = loadImage("logan.jpg");
  fimg2 = loadImage("it.jpg");
  fimg3 = loadImage("dunkirk.jpg");
  fimg4 = loadImage("starwars.jpg");

  //////////Film 1 - LOGAN
    app.image(fimg1,5,140,180,170);
    app.text("Rating: 8.1 / 10",5,340); //fixed rating

    app.text("Genres: Action | Drama", 5, 365);
    app.text("| Sci-Fi | Thriller",5,390);

    //Ratings that are constantly changing using the random function
    for (int i = 0; i < 50; i++) 
    {
      r = random(0, 6);
    }

    String user = "Ratings by users: " + nf(r,0,1) + " / 10";
    app.text(user, 5,430);

    // the random function of the comments
    int index = int(random(rev_film1.length)); 
    String user11 = "Reviews: " + "\n" + rev_film1[index];
    app.text(user11, 5,460);


  ////////////////////Film 2 - IT
    app.image(fimg2,960,360,180,170);
    app.text("Rating: 7.6 / 10", 700,400);
    app.text("Genres: Drama | Horror",700,430);
    app.text("| Thriller",700,460);

  //Ratings that are constantly changing using the random function
    for (int i = 0; i < 50; i++) 
    {
      r = random(5, 10);
    }
    String user2 = "Ratings by users: " + nf(r,0,1) + " / 10";
    app.text(user2, 700,500);
    int index2 = int(random(rev_film2.length)); // the random function of the comments
    String user22 = "Reviews: " + "\n" + rev_film2[index2];
    app.text(user22, 700,540);



  /////////Film 3 - DUNKIRK
    app.image(fimg3,320,250,180,170);
    app.text("Rating: 8.1 / 10",320,445); //fixed rating

    app.text("Genres: Action | Drama", 320, 470);
    app.text("| History | Thriller | War",320,495);

    //Ratings that are constantly changing using the random function
    for (int i = 0; i < 50; i++) 
    {
    r = random(0, 5);
    }

    String user3 = "Ratings by users: " + nf(r,0,1) + " / 10";
    app.text(user3, 320,530);
    int index3 = int(random(rev_film3.length)); // the random function of the comments
    String user33 = "Reviews: " + "\n" + rev_film3[index3];
    app.text(user33, 320,560);


  /////////////Film 4 - STAR WARS
    app.image(fimg4,570,120,180,170);
    app.text("Rating: 7.6 / 10", 760,140); //fixed rating

    app.text("Genres: Action | Adventure | Fantasy ", 760,168); 
    app.text("| Sci-Fi", 760,195);

    //Ratings that are constantly changing using the random function
    for (int i = 0; i < 50; i++) 
    {
      r = random(0, 2);
    }

    String user4 = "Ratings by users: " + nf(r,0,1) + " / 10";
    app.text(user4, 760,220);
    int index4 = int(random(rev_film4.length)); // the random function of the comments
    String user44 = "Reviews: " + "\n" + rev_film4[index4];
    app.text(user44, 760,250);
}


public void windowClosing(GWindow w)
{
  btn.setEnabled(false);
  player.close();
  minim.stop();
  exit();
}

Ответы на вопрос(1)

Ваш ответ на вопрос