Chap | Page | Line |
|
|
|
|
replace by f.setVisible(true); |
|
|
|
replace fields1 by field1 |
|
|
|
replace fields2 by field3 |
|
|
|
remove one asterix from both sides of the heading (only 5 asterisks
in code)
message should read: Enter a cheque number of ten digits separated by a space and ending with a return |
|
|
|
replace line by Type numbers, ending with control-D (unix) or control-Z (Windows) |
|
|
|
replace 'The total is 63.0' by 'The total of the 5 numbers is 63.0' |
|
|
|
remove BufferedReader |
|
|
|
remove quotation mark at then end of the line |
|
|
|
replace '***** Controlling an apparatus *****' by '***** Controlling an engine *****' |
|
|
|
insert System.out.println("What
is the target number? ");
between BufferedReader in = ... and try { |
|
|
|
insert
System.out.println("Try to hit the target"); int number = 0; between try { and do { |
|
|
|
remove int from int number = ... |
|
|
|
insert System.out.println("You
got it!");
between '} while (number != ...' and '}' on line 5 |
|
|
|
insert import javagently.* before import java.util.Random; |
|
|
|
on both lines, enclose Text.writeInt(...)
statement by a System.out.print(...)
statement
(e.g. System.out.println(Text.writeInt(i, 6))) |
|
|
|
replace line by int noofJudges; |
|
|
|
add a semi-colon at then end of the line |
|
|
|
add import java.io.*; before import javagently.*; |
|
|
|
replace DataInputStream by BufferedReader in parameter block |
|
|
|
add System.out.println("
"); between System.out.println();
and
for (int i=0; i<rowmax; i++) |
|
|
|
insert BufferedReader fin; between System.out.print(... and try { |
|
|
|
delete BufferedReader |
|
|
|
replace line by System.out.println("Using my own test map gold.dat"); |
|
|
|
change startyear to startYear and endyear to endYear |
|
|
|
replace line by Data read in for 1987 to 1994 |
|
|
|
switch these two lines around, so they read
if (i>0 && i % 7 == 0) System.out.println(); System.out.print(a[i]+"\t"); |
|
|
|
There should now only be 7 columns of symbols. |
|
|
|
replace line by * Stores names and 6 marks |
|
|
|
add a semi-colon to the end of the line |
|
|
|
remove the extra opening bracket. Line is now System.out.println(result.intValue()); |
|
|
|
replace line by In the table are |
|
|
|
change system to System |
|
|
|
replace instock by inStock |
|
|
|
replace Clonable by Cloneable |
|
|
|
insert import myutilities.*; beneath import java.text.*; |
|
|
|
insert import myutilities.*; beneath import java.text.*; |
|
|
|
replace Clonable by Cloneable |
|
|
|
insert keyword public beofre interface Sortable { |
|
|
|
add a closing brace (}) on line 12, and remove the one on line -11
(i.e. break the class into two, in the same file) |
|
|
|
remove quotation mark from inside new GraphicWarning("); |
|
|
|
The declaration of ButtonTest should exclude the title parameter, i.e.
public ButtonTest (String[] message, int n) { |
|
|
|
remove the title parameter |
|
|
|
remove the call to super(title) |
|
|
|
replace line by Panel p = new Panel(); |
|
|
|
remove the call to setTitle("Traffic Lights version 0");. It's called later in main. |
|
|
|
replace panel by Panel |
|
|
|
replace line by title.add(new Label("Savanna Traffic Light Simulation")); |
|
|
|
insert
import java.awt.*; import.awt.event.*; before class SetOfLights... |
|
|
|
insert the following method:
static int a(int x) { return (int)(Math.random()*x)+1; } |
|
|
|
replace out.println(...) by conout.println(...) |
|
|
|
replace String s = in.readLine(); by String s = conin.readLine(); |
|
|
|
replace out.println(...) by conout.println(...) |
|
|
|
The item
class is taken from example 15.1, and needs to be modified to handle int's,
not char's.
item (int i) { data = i; } int data; |
|
|
|
insert the following method:
public boolean more (Object x) { return (height > ((Student)x.height); } |
|
|
|
insert the following method:
public boolean more (Object x) { return (height > ((Student)x.height); } |
|
|
|
replace here by there |
|
|
|
replace variable by constant |