Vous êtes sur la page 1sur 1

Quiz 2 Solutions:

Problem 1.
1. F
2. F
3. T
4. a. F
b. F

Problem 2.
Part 1.
public void actionPerformed(ActionEvent event) {
numClicks++;
button.setText("Number of Clicks: " + numClicks);

if ( (numClicks % 2 == 1) ) {
button.setBackground(ODD_COLOR);
} else {
button.setBackground(EVEN_COLOR);
}
}

Part 2.
public static void main(String[] args) {
Clicker c = new Clicker();
c.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
c.pack();
c.setVisible(true);
}

Problem 3:

a. f.function(x);
b. return (int)Math.pow((double)x, 1.0/3.0);
c. return x+1;
d. f.function(g.function(x));
e. new FofG(f, g), 1, 10

Vous aimerez peut-être aussi