import java.util.Scanner;
public class ZhouEr {
public static void main(String[] args) {
int [] arr1 = new int[5];
String arr2[] = new String[5];
double [] arr3 = new double[5];
Scanner sca = new Scanner(System.in);
int i ;
int count = 0;
while(true){
System.out.println("=图书管理系统1.0=");
System.out.println("1.添加");
System.out.println("2.修改");
System.out.println("3.删除");
System.out.println("4.查询");
System.out.println("5.退出");
int book = sca.nextInt();
if(book == 1){
System.out.println("添加图书");
System.out.print("--输入图书编号");
arr1[count] = sca.nextInt();
System.out.print("--输入图书名");
arr2[count] = sca.next();
System.out.print("--输入图书价格");
arr3[count] = sca.nextDouble();
System.out.println("成功添加");
count ++;
for(int j = 0;j
if(arr1[j]==0){
break;
}
System.out.println("已经添加的是:"+arr1[j]+arr2[j]+arr3[j]);
}
}else if(book == 2){
System.out.println("修改图书");
System.out.print("选择要修改的图书编号:");
int upId = sca.nextInt();
for(int ii = 0; ii < arr1.length; ii ++) {
if(upId == arr1[ii]) {
System.out.print("--输入图书名");
arr2[ii] = sca.next();
System.out.print("--输入图书价格");
arr3[ii] = sca.nextDouble();
System.out.println("成功修改");
}
}
for(int j = 0;j <5;j++){
if(arr1[j]==0){
break;
}
System.out.println("修改后的书库是:"+arr1[j]+arr2[j]+arr3[j]);
}
}else if(book == 3){
System.out.println("删除图书");
System.out.print("选择要删除的图书编号:");
int upId = sca.nextInt();
for(int k = 0;k < arr1.length;k ++) {
if(upId == arr1[k]) {
for(int g = k;g < arr1.length-1;g ++) {
arr1[g] = arr1[g + 1];
}
}
}
//arr1[upId-1] = 0;
//arr2[upId-1] = null;
//arr3[upId-1] = 0.0;
for(int j = 0;j <5;j++){
if(arr1[j]==0){
break;
}
System.out.println("删除后的书库是:"+arr1[j]+arr2[j]+arr3[j]);
}
}else if(book == 5){
System.out.println("退出系统");
return;
}
}
}
}