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