Make sure review the homework assignments, quizzes, and all of the example programs we've developed in class.
Hello World to the console.
int count = 0;
int age;
DOuble pi = 3.14159;
String myname = "Poindexter;
int the answer = 9;
StdOut.println("What do" + 1 + (2 + 3) + 4 + " I print?");
int i;
int j;
i = 0;
while (i < 5) {
j = 1;
while (j < i+1) {
StdOut.print(j);
j = j + 1;
}
StdOut.println();
i = i + 1;
}
int sum;
int i;
sum = 0;
i = 0;
while (i < 12) {
sum = sum + i;
i = i + 2;
}
StdOut.println(sum);
int x; x = 1/3; StdOut.println(x);
public class Exam1 ______________________________________________
void run() { ______________________________________________
int XXXX; ______________________________________________
XXXX = 7; ______________________________________________
int pi; ______________________________________________
pi = 3.14159; ______________________________________________
StdOut.println(XXXX); ______________________________________________
Picture p; ______________________________________________
p = new Picture(); ______________________________________________
graphics g; ______________________________________________
g = getGraphics(); ______________________________________________
g.fillOval(XXXX, XXXX*100, 20); ______________________________________________
int sum = 0; ______________________________________________
while (sum < 10 { ______________________________________________
sum = sum + I ______________________________________________
} ______________________________________________
StdOut.println(sum); ______________________________________________
} ______________________________________________
public static void main(String [] args) {
Program p = new Program();
p.run();
}
}
int sum;
sum = 0;
i = 4;
while (i <= 8) {
sum = sum * i;
}
StdOut.println(sum);
myint and give it the value 127.
Picture p = new Picture(200,200); Graphics g = p.getGraphics(); g.setColor(Color.black); g.fillRect(0,200,50,50); p.repaint();
The answer is not because we forgot the import statement or
main program.
20.6.
rint in the Math class).
For example, if I entered 33, 12, and 17 your code should print 20.7.
hello count 5times int pepper2 while iden_tifier APPLES &*( do-it if else
int x = 7; int y = 9; int z = x + y / 4 * (x - 2); StdOut.println(z);