Class AutoPolicy
Class AutoPolicy (Fig. 5.11) represents an auto insurance policy. The class contains:
• int instance variable accountNumber (line 5) to store the policy’s account number
• String instance variable makeAndModel (line 6) to store the car’s make and model (such as a "Toyota Camry")
• String instance variable state (line 7) to store a two-character state abbreviation representing the state in which the policy is held (e.g., "MA" for Massachusetts)
• a constructor (lines 10–15) that initializes the class’s instance variables
• methods setAccountNumber and getAccountNumber (lines 18–27) to set and get an AutoPolicy’s accountNumber instance variable
• methods setMakeAndModel and getMakeAndModel (lines 30–39) to set and get an AutoPolicy ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access