/* Person.java 1.0 2-4-03 */ /* modified by S. Tuttle */ /* (modified from example by C. Cartwright) */ class Person { /* fields */ String name; double heightInInches; /* constructor */ Person(String nm, double htInInches) { this.name = nm; this.heightInInches = htInInches; } /* accessors */ String getName() { return this.name; } double getHeightInMeters() { return this.heightInInches * Conversions.METERS_PER_INCH; } // why can't you write getHeightInMetersTest() here? // well --- WHAT'S the associated object??? double getHeightInInches() { return heightInInches; } /* overridden methods */ public String toString() { return "Person[" + this.name + ", " + this.heightInInches + " inches]"; } }