Skip to content

Issues - 등록된 자전거가 없을 경우 출력 #26

@ggujin

Description

@ggujin

이슈사항

등록된 자전거가 없을 경우, "등록된 자전거가 없습니다"라고 출력한다 (자전거 목록 조회, 자전거 삭제)

자전거 삭제

  • 이미 코드가 존재하여서 안에 문구수정만 해보았습니다.
void removeBike() {
        io.loadRentList();
        Scanner scan = new Scanner(System.in);
        System.out.println("원하는 삭제 방법을 선택해 주세요");
        System.out.println("1. 특정 자전거 삭제 | 2. 일괄 삭제");
        int menu = Integer.parseInt(scan.nextLine());
        if (!(menu == 1 || menu == 2)) {
            System.out.println("잘못 입력");
        } else if (bikeList.isEmpty()) {
            // System.out.println("삭제할 자전거가 없습니다.");
           System.out.println("등록된 자전거가 없습니다.");

image

자전거 목록 조회

*등록된 자전거가 없습니다 문구 추가하였습니다.

void readBikeList () {
        File file =new File(fileRoot+"bikelist.txt");
        FileInputStream fis =null;
        BufferedInputStream bis =null;
        ObjectInputStream ois =null;

        try{
            fis =new FileInputStream(file);
            bis =new BufferedInputStream(fis);
            ois =new ObjectInputStream(bis);

            bikeList = (HashMap<String, Bike>) ois.readObject();

            System.out.println("====== 비트를 타쇼 자전거 등록 리스트 ======");

            for (Map.Entry<String,Bike> entrySet : bikeList.entrySet()) {
                System.out.println("["+entrySet.getKey()+"]" + entrySet.getValue());
            }

            if(bikeList.size() == 0) { // 양수진 - 수정
                System.out.println("등록된 자전거가 없습니다.");
                }

            System.out.println("========================================");

image

image

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions