Statistics:
mean 22.824 (383.000/17) stddev 4.176 median 23.000 midrange 21.000-26.000 # avg 1 6.53 / 10 2 8.71 / 10 3 7.59 / 10
Suppose a user executes the following run() method.
public static void run() {
String str = "arboreteum";
int j = 0;
for(int i = 0; i < str.length(); i++) {
if(str.charAt(i) == 'r') {
IO.print(str.substring(j, i));
j = i + 1;
}
}
IO.println(str.substring(j));
}
i j
Say we've defined the following method.
public static int f(int n) {
IO.println(n);
return n / 2;
}
IO.println(1 + f(1 + f(12)));
What does the following method print?
import csbsju.cs160.*;
public class Q3 {
public static void run() {
Account a = new Account();
a.deposit(2.0);
Account b = new Account();
b.deposit(4.0);
Account c = b;
b = a;
b.deposit(8.0);
IO.println(a.getBalance());
IO.println(b.getBalance());
IO.println(c.getBalance());
}
}
i 0 1 2 3 4 5 6 7 8 9 10 j 0 2 5It prints ``aboeteum''.
12 7 4
10.0 10.0 4.0