Programming and Problem Solving with Java

(やまだぃちぅ) #1

CASE STUDY


364


// Read in rest of name
last = inFile.readLine();
middle = inFile.readLine();
name = newName(first, last, middle);

// Read in address
street = inFile.readLine();
city = inFile.readLine();
state = inFile.readLine();
zip = inFile.readLine();
address = newAddress(street, city, state, zip);

// Read in phone number
areaCode = Integer.parseInt(inFile.readLine());
number = Integer.parseInt(inFile.readLine());
phone = newPhone(areaCode, number);

// Prompt for and read in birthday
System.out.println("Enter the birthday for "+ name.full()
+ " as integers.");
System.out.println("Month: ");
month = Integer.parseInt(in.readLine());
System.out.println("Day: ");
day = Integer.parseInt(in.readLine());
System.out.println("Year: ");
year = Integer.parseInt(in.readLine());
birthday = newGregorianCalendar(month, day, year);

// Instantiate and output entry
entry = newEntryPlus(name, address, phone, birthday);
entry.writeToFile(outObject);

first = inFile.readLine();
}
outObject.close();
inFile.close();
}
}
Free download pdf