宠物商店完整版

package pet;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        PetsStore store = new PetsStore();

        System.out.print("请为您的宠物商店取个名字:");
        store.setName(input.nextLine());
        System.out.println("您好!" + store.getName() + "的店长,欢迎使用宠物商店管理系统!");

        String choice = "1";

        while (choice.equals("0") == false) {
            System.out.println("==========宠物商店管理系统==========");
            System.out.println("1.查看库存\n" + "2.添加宠物\n" + "3.出售宠物\n" + "4.查看盈利\n" + "5.销售记录\n" + "0.退出程序");
            System.out.println("===================================");
            System.out.print("请输入你的选择:");
            choice = input.next();

            switch (choice) {
            case "1":
                store.print();
                System.out.println("请问您还需要什么服务?");
                break;

            case "2":
                String choice1 = "1";
                do {
                    store.addPets();
                    System.out.println("是否继续添加?\n" + "1.是             2.否");
                    choice1 = input.next();
                } while (choice1.equals("1"));
                System.out.println("请问您还需要什么服务?");
                break;

            case "3":
                String choice2 = "1";
                do {
                    store.sell();
                    System.out.println("是否继续出售?\n" + "1.是             2.否");
                    choice2 = input.next();
                } while (choice2.equals("1"));
                System.out.println("请问您还需要什么服务?");
                break;

            case "4":
                store.profitNote();
                System.out.println("请问您还需要什么服务?");
                break;

            case "5":
                store.note();
                System.out.println("请问您还需要什么服务?");
                break;

            case "0":
                System.out.println("谢谢您的使用,欢迎下次再来!\n" + "**********按任意键结束程序**********");
                break;

            default:
                System.out.println("错误输入, 请重新输入!");
                break;
            }

        }
    }
}
 

--------------------------------------------------------------------------------------------------------------------------------

 

package pet;

public class Pets {
    private String color; // 颜色
    private int age; // 年龄
    private String

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值