Programming and Problem Solving with Java

(やまだぃちぅ) #1

CASE STUDY


310


street = newStreet;
city = newCity;
state = newState;
zipCode = zip;
}

// Knowledge methods
publicString knowStreet()
{
returnstreet;
}
publicString knowCity()
{
returncity;
}
publicString knowState()
{
returnstate;
}
publicString knowZip()
{
returnzipCode;
}
}

//**************************************************************
// This class provides a basic entry object. The constructor
// takes the state variables as class objects. Three
// knowledge methods return the state objects. An observer
// writes the contents of the state objects on the file passed
// as a parameter.
//**************************************************************

packageaddressBook;
// Includes Name, Address, Phone, and Entry
importjava.io.*;
public classEntry
{
// Instance variables
Name name;
Address address;
Phone phone;

publicEntry(Name newName, Address newAddress, Phone phoneNumber)
{
name = newName;
address = newAddress;
phone = phoneNumber;
}

T


E


A


M


F


L


Y


Team-Fly®

Free download pdf