Appendix B. Solutions
Adapter (Chapter 3)...................................................................................................................................
SOLUTION 3.1.......................................................................................................................................
Your solution should look something like Figure B.2.
Figure B.2. This ShellAsRocket class relies on fireworks physics that can model a
shell's apogee and "thrust" from its muzzle velocity.
SOLUTION 3.2.......................................................................................................................................
One set of solutions for the missing methods is:
package com.oozinoz.applications;
import javax.swing.table.;
import com.oozinoz.fireworks.;
public class RocketTable extends AbstractTableModel
{
protected Rocket[] rockets;
protected String[] columnNames =
new String[] { "Name", "Price", "Apogee" };
public RocketTable(Rocket[] rockets)
{
this.rockets = rockets;
}
public int getColumnCount()
{
return columnNames.length;
}
public String getColumnName(int i)
{
return columnNames[i];
}