Change Contents of the Bubble
View this PageEdit this PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Midterm exam 2 review Fall2005: Unscramble the Code

Post questions, comments, answers, comments on answers, etc. here.
(Return to Midterm Exam 2 Review Fall2005)


Let's take a try.
A. 
  public void mirrorHorizontalBottomToTop() {
    int mirrorPoint = (int) (getHeight() / 2);
    Pixel topPixel = null;
    Pixel bottomPixel = null;
    for (int x=0; x < getWidth(); x++) {
      for (int y=1; y < mirrorPoint; y++)
      {
        topPixel = getPixel(x,(mirrorPoint - y));
        bottomPixel = getPixel(x,(mirrorPoint + y));
        topPixel.setColor(bottomPixel.getColor());
      }
    }

B.
  public LLNode last() {
    LLNode current;
    current = this;
    while (current.getNext() != null) {
      current = current.getNext();
    }
    return current;
 }

C.
  JPanel panel2 = new JPanel();
  this.getContentPane().add(panel2);
  JButton button1 = new JButton("Make a sound");
  button1.addActionREMOVEDstener(
    new ActionREMOVEDstener() {
      public void actionPerformed(ActionEvent e) {
         Sound s = new Sound(FileChooser.getMediaPath("warble-h.wav"));
         s.play();
      }
    }
  ) 
  panel2.add(button1);



D.
  JPanel panel2 = new JPanel();
  this.getContentPane().add(panel2,BorderLayout.SOUTH);
  JButton button1 = new JButton("Make a sound");
  panel2.add(button1);
  JButton button2 = new JButton("Make a picture");
  panel2.add(button2);
  this.pack();
  this.setVisible(true);

I pretty sure I missed a few semicolons because that's usually what I have the most difficulty with...
Student159

I petition not to have C. on the test. puleez~♪
Kyle DuPont

I don't see missing semicolons, but there are some missing "}"'s. Mark Guzdial



Link to this Page