Key for exam form with first question: "Some allowed suffixes..."
The bug: The words "Advantages for Apple" should be enclosed in <title></title> tags
When the bug is fixed, this HTML will put the words "Advantages for Apple" on the title bar, and the following in the browser window:
Part 1: 21
Part 2: 0
StringField s1Field;
StringField s2Field; // the declarations were optional on the exam
s1Field = new StringField();
s2Field = new StringField();
s1Field.setLabel("next");
add(s1Field);
add(s2Field);
s1Field.setString("hi there");
s2Field.setString("yes sir");
String s1; // this declaration was optional on the exam s1 = s2Field.getString(); s1= s1 + "A"; s2Field.setString(s1);
String s1; // this declaration was optional on the exam s1 = s2Field.getString(); s1 = s1.substring(0,s1.length()-1); s2Field.setString(s1);
String s1; // this declaration was optional on the exam
s1 = s1Field.getString();
if (s1.indexOf("x") > -1)
{
s2Field.setString("Yes");
}
String s1; // this declaration was optional on the exam
s1 = s2Field.getString();
s1 = s1.substring(0, s1.indexOf("X") + 1);
s2Field.setString(s1);
public double disprice()
{
price = price - price * 0.15;
return price;
}
public void authoradd(String s1, String s2)
{
author = s1 + author + s2;
}
| INDEX | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| VALUE | 17 | 10 | 2 | 6 | 10 | 15 | 11 | 16 | 22 | 23 |
import java.awt.*;
import awb.*;
public class e1 extends java.applet.Applet
{
double rr[];
int i, numZeros;
Button x1;
IntField s1Field;
public void init()
{
rr = new double[100];
Button x1 = new Button("X1");
s1Field = new IntField();
s1Field.setLabel("Answer");
add(s1Field);
add(x1);
}
public boolean action(Event e, Object obj)
{
if (e.target == x1)
{
i = 0;
numZeros = 0;
while (i < 100)
{
if (rr[1] == 0)
{
numZeros = numZeros + 1;
}
i = i + 1;
}
s1Field.setInt(numZeros);
return true;
}
return true;
}
}