The test will cover material presented in class or from the assigned reading to date (chapters 1 - 8 of Bell and Parr along with Appendix C). Note that the intent is to determine whether you could write a simple program in Java, and that you understand the basics of object-oriented design and implementation. Questions will not be based on small esoteric details from the book or class.
import java.awt.* import java.applet.applet; public class A extend Applet { public paint(Graphics clown) { int a = 40; clown.drawString("aaa", 30); float b = 90; clown.fillRect(a, b, a, b) } }
int j = 22; float k = 22.0f; int h = 4; j = j / h; k = k / h; j = (j * 6) / 5;
int m = 107; int n = 0; while (m > 7) { m = m / 8; n = n + 1; }
public void paint(Graphics cc) { int aa = 20; cc.drawLine(20, 20, 20, 300); cc.drawLine(20, 300, 300, 300); while (aa < 300) { cc.drawline(20, aa, aa, 300); aa = aa + 100; } }
public void paint(Graphics goo) { int larger = 1000 + (int)(Math.random()*1000); int smaller = 1 + (int)(Math.random()*1000); goo.drawString("larger: "+larger, 20, 20); goo.drawString("smaller: "+smaller, 20, 50); // your code here }
public void paint(Graphics g42) { int n = (int)(Math.random()*10); g42.drawString("Power: " + n, 20, 20); // your code here }
import java.awt.*; import java.applet.Applet; public class Stars extends Applet { public void paint(Graphics gx) { drawStar(40, 40, 50, gx); drawStar(100, 100, 90, gx); } }