Objective: Using Java coding language,complete each \"TO-DO\" section for the followingclasses.
Shape code (for reference, nothing to completehere):
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.io.RandomAccessFile;
public abstract class Shape extends Rectangle {
  public int id;
  public Color color;
  public int xSpeed, ySpeed;
 Â
  public Shape(int id, int x, int y, int width, intheight, Color color, int xSpeed, int ySpeed) {
     super(x,y,width,height);
     this.id = id;
     this.color = color;
     this.xSpeed = xSpeed;
     this.ySpeed = ySpeed;
  }
 Â
  public abstract void move(int screenWidth, intscreenHeight);
  public abstract void draw(Graphics g);
  public abstract void save(RandomAccessFile raf) throwsException;
 Â
}
Ball code:
import java.awt.Color;
import java.awt.Graphics;
import java.io.RandomAccessFile;
public class Ball extends Shape {
  public Ball(int id, int x, int y, int size, Colorcolor, int xSpeed, int ySpeed) {
     super(id, x, y, size, size, color,xSpeed, ySpeed);
  }
  @Override
  public void move(int screenWidth, int screenHeight){
     x += xSpeed;
     y += ySpeed;
    Â
     if(x > screenWidth) x =-width;
     else if(x + width < 0) x =screenWidth;
    Â
     if(y > screenHeight) y =-height;
     else if(y + height < 0) y =screenHeight;    Â
  }
  @Override
  public void draw(Graphics g) {
     g.setColor(color);
     g.fillOval(x, y, width,height);
     g.setColor(Color.BLACK);
     g.drawOval(x, y, width,height);
  }
  // TO-DO:   Write the code thatsaves out the type of object (Ball)
  //        and all data about the box (\"Ball\", id, x, y, width, height,color,
  //        xSpeed, and ySpeed)
  @Override
  public void save(RandomAccessFile raf) throwsException {
     // Note, when saving color you willsave it as an int: color.getRGB()
  }
}
Box code:
import java.awt.Color;
import java.awt.Graphics;
import java.io.RandomAccessFile;
// is-a
public class Box extends Shape {
  public Box(int id, int x, int y, int size, Colorcolor, int xSpeed, int ySpeed) {
     super(id, x, y, size, size, color,xSpeed, ySpeed);
  }
  @Override
  public void move(int screenWidth, int screenHeight){
     x += xSpeed;
     y += ySpeed;
    Â
     if(x > screenWidth) x =-width;
     else if(x + width < 0) x =screenWidth;
    Â
     if(y > screenHeight) y =-height;
     else if(y + height < 0) y =screenHeight;
                Â
  }
  @Override
  public void draw(Graphics g) {
     g.setColor(color);
     g.fillRect(x, y, width,height);
     g.setColor(Color.BLACK);
     g.drawRect(x, y, width,height);
  }
  // TO-DO:   Write the code thatsaves out the type of object (Box)
  //        and all data about the box (\"Box\", id, x, y, width, height,color,
  //        xSpeed, and ySpeed)
  @Override
  public void save(RandomAccessFile raf) throwsException {
     // Note, when saving color you willsave it as an int: color.getRGB()
  }
}