String.charAt(int) 行でデバッグ エラーが発生しました: この行では使用できません
ch = Ach.charAt(0);
char ch;
String Ach;
Scanner input = new Scanner(System.in);
printvehicleMAKE(services, input);
do{
System.out.println("\n Service Item Recording Feature");
System.out.println(" ------------------------------");
System.out.println("\n\n A - Record Part Details");
System.out.println("\n B - Add Labour Hours");
System.out.println("\n X - Exit service item recording feature");
System.out.print("\n\nEnter your selection: ");
Ach = input.nextLine().toUpperCase();
ch = Ach.charAt(0);
switch(ch){
case 'A':
System.out.print("Enter registration number of vehicle: ");
String inputREGO = input.nextLine();
boolean flag = false;
for(int i=0; i<6; i++){
if(inputREGO.equalsIgnoreCase(services[i].getregoNUMBER())){
System.out.print("Enter Part Description: ");
String parts = input.nextLine();
System.out.print("Enter Part Cost: ");
Double cost = input.nextDouble();
services[i].addPARTDETAILS(parts, cost);
flag = true;
}
}
if(!flag)
System.out.println("No registration number were found in the system.");
break;
case 'B' :
break;
case 'X' :
System.out.println("Exiting system......");
break;
default: System.out.println("Error - invalid selection entered!");
break;
}
}while(ch!='X');
public static void printvehicleMAKE(ServiceAppointment[] services, Scanner
input){
System.out.print("Enter vehicle make: ");
String make = input.nextLine();
boolean flag = false;
for (int i=0;i<6;i++){
if (services[i].getvehicleMAKEMODEL().indexOf(make) != -1){
System.out.printf("\n%-10s%-8s%10s", services[i].getregoNUMBER(),
services[i].getbuildYEAR(), services[i].getvehicleMAKEMODEL());
flag=true;
}
}if(!flag)
System.out.println("No service appointments were found for vehicles "
+ "made by " + make);
}