Solve this entire Processing exercise with no aditional comments or explanations, simply give me the altered code already perfectly solved: {//      last name:
//     first name:
//          class:
// student number:


/*
 Before solving the question;
 Check the movie for a visual representation. Also, try out the start code and see what happens when you
 press a key, move the mouse simultaneously, and bring the fish close to the shark. 
 Press the space-bar when the shark has eaten the fish. 
 This functionality should be similar for every single fish object you create.
 You could say a user has to keep the fish away from the shark.
 Use the black-box principle. You don't have to understand all parts of the given code to solve the question.
 
 5a)
 Make a class that creates a fish object using parameters for the x-position, the y-position, and the image
 (constructor with 3 arguments). The constructor should use these parameters to create the object and store
 the values in the applicable instance variables. The constructor should also give the other instance variables 
 a proper value as done for the single fish. So each fish will be different.

 Show 3 fish objects on the screen. Spread them but keep them within the screen.
 Make sure you also put 'Fish' functions in the class; otherwise, you will get errors.
  
 
 5b) Let the fish interact with the keyboard, the mouse, and the shark. In the same way as the fish in the start code.
 In keyPressed:
 Use the '2'-key to set the y position of the 1st fish equal to the mouseY
 use the '4'-key to set the y position of the 2nd fish equal to the mouseY
 use the '6'-key to set the y position of the 3rd fish equal to the mouseY
 
 Call the method checkDistance(), which you should have added to the class, for each individual fish
 to see if the shark can eat one of the fish. The checkdistance() returns true or false, so you can
 use it as a condition in the if. When correct, you will see that the shark will eat that fish when the fish is too close to the
 shark.
 
 Call the method reset() that you should have added to the class for each individual fish when the
 space is pressed so you can keep on playing.
 
 Tip! If you run into a struggle with positioning the images, you are allowed to replace that with
 rectangles with the same dimensions.
 
 */


// images retrieved from https://www.vecteezy.com/free-vector/cartoon-fish free license and
//  https://www.pngwing.com/en/free-png-njsbu non commercial use.


// Color constants
color bgc = color(13, 43, 143);

// Fish variables
PImage fishImage;
int sizeFish = 100;
int x = width/2;
int y = 200;
float speed = 1;
int scaleX = 1;
boolean isAlive = false;

// General variables
PImage imgF, imgC, shark;
int sharkX = 700;
int sharkY= 675;
boolean issharkAlive = false;



void settings()  // preload before setup to already load the images which are used in setup().
  size(900, 600);
  imgF = loadImage("shark.png"); // you only have to load the image once.
  imgC = loadImage("fish.png");


void setup() 
  /* Setup the fish. Each fish needs to be different so the constructor should take care of this.
      Part of it needs to be done based on the arguments (for x, y and the fishImage)*/
    x = width/2;
    y = 400;
    fishImage = imgC.copy(); // a copy keeps the original. Convenient for changing the sizes of individual fish.
    sizeFish = (int)random(25, 100);
    fishImage.resize(sizeFish, 0);
    speed = 100/sizeFish;
    isAlive = true;
  
  /* Setup the shark. Keep this in the main setup */
  shark = imgF.copy();


void draw() {
  drawDefaultItems();
  
  //draw and move fish
  if (isAlive) 
    // draw fish
    pushMatrix();
    translate(sizeFish/2, 0);
    scale(scaleX, 1.0); // flips the canvas on scaleX so x values are flipped with it. fish will either move left-right or right to left.
    translate(-sizeFish/2, 0);

    imageMode(CORNER);
    image(fishImage, x*scaleX, y);

    noFill();
    popMatrix();
  
  moveFish();
  
  /* Each fish should be checked in the main code if it's not too close to the shark.   */
  if (checkDistance(sharkX, sharkY)) 
    sharkY = 500;
  
  
}

// Functions that are used by the fish
void moveFish() {
  if (isAlive) {
    x += speed;
    if (x< 0 || x > width - fishImage.width ) 
      speed = -speed;
      x += speed;
      scaleX = -scaleX;
      y+= fishImage.height;
    
  }
}

void resetFish() {
  if (!isAlive) 
    isAlive = true;
    y = (int)random(100, 500);
  
}

boolean checkDistance(int predatorX, int predatorY) {
  boolean isNearby = false;

  if ( dist(predatorX-100, predatorY, x+sizeFish/2, y) < 250 && abs((predatorX-100) - (x+sizeFish/2)) < abs(speed)) 
    isAlive = false;
    isNearby = true;
  
  return isNearby;
}


// General functions that should stay in main.  

void keyPressed() { // changes inside are needed to make it work for each Fish.
  noCursor();
  /* Depending on the pressed key a dedicated fish should be placed at mousePosition */
  y = mouseY;
  
  if (key == ' ') 
    sharkY = 675;
    /* Each fish should reset itself. */
    resetFish();
  
}

void keyReleased() 
  cursor();


void drawDefaultItems() // Don't change this function or move it to the class
 //draw background and the shark
  background(bgc);
  imageMode(CENTER);
  image(shark, sharkX, sharkY);
  
}