자바 프로그래밍 과제
- 최초 등록일
- 2010.07.01
- 최종 저작일
- 2010.07
- 10페이지/ 한컴오피스
- 가격 2,000원
소개글
자바 프로그래밍 과제
목차
1. 문제정의 및 분석
2. 소스코드 및 설명
3. 실행결과 및 설명
4. 결론
본문내용
1. 문제 정의 및 분석
(a) 문제 정의
과제 6과 비슷하지만, 직렬화 역직렬화를 이용하여 write 및 read 합니다.
(b) 문제 분석
AddressBookImpl01클래스에 있는 save()와 save(String strFile) 함수를 고치고, Data클래스를 상속 받습니다.
2. 소스코드 및 설명
public class Data {
public String strName; //이름
public String strAddress; //주소
public String strPhone; //전화번호
}
==================================================================================
import java.io.*;
public interface AddressBook {
/* 주소록 파일로부터 데이터를 읽어와 벡터 객체에 저장 */
public void init(String strFile) throws IOException;
/* 주소록에 새 주소 데이터 추가 */
public void add(String strName, String strAddress, String strPhone);
/* 갱신된 주소록을 원래 파일에 저장 */
public void save() throws IOException;
/* 주소록을 새 파일에 저장 */
public void save(String strFile) throws IOException;
/* 주소록을 삭제 */
public void delete(String strFile) throws IOException;
/* 주소록을 수정 */
public void modify(String searchFile, String strFile) throws IOException;
}
import java.util.*;
import java.io.*;
public class AddressBookImpl01 implements AddressBook{
private ArrayList List = null; //Data 객체를 담는 ArrayList 변수 선언
private File file = null; //파일관리
private Data address = null;
public void init(String strFile) throws IOException{
FileReader fr = null;
BufferedReader br = null;
참고 자료
없음