package wow;
import javax.swing.JOptionPane;
public class WowInput {
public static void main(String[] args) {
String input;
String [][]card ={
{"","26","23","01","67","84","67","78","99","21","73"},
{"","95","57","14","24","73","92","91","00","54","75"},
{"","24","65","05","68","17","17","00","68","26","63"},
{"","68","88","51","30","89","39","05","90","62","28"},
{"","33","31","83","76","42","11","16","08","89","56"},
{"","77","22","51","23","17","02","78","99","90","11"},
{"","12","01","31","44","51","67","72","82","99","10"},
{"","12","23","44","15","78","00","02","04","54","19"}
};
int xiabiaoshu=0;
String []Z={"z","a","b","c","d","e","f","g","h"};
int [] az = {1,2,3,4,5,6,7,8};
do{
String zimu =JOptionPane.showInputDialog("请输入密保查询号之字母部分(输入范围为:a-h)");
String s =JOptionPane.showInputDialog("请输入密保查询号之数字部分(输入范围为:1-10)");
int shuzi =Integer.parseInt(s);
//建立一个字符数组,按顺序录入A到H,之后返回对应的下标,用字母Z占0下标。
for(int shu : az)//这就是问题所在了。
if (zimu == Z[shu])
{xiabiaoshu =shu;
}
System.out.println(card[xiabiaoshu][shuzi]);
input=JOptionPane.showInputDialog("继续使用吗?(y/n)");}
while(input.equals("y"));
}
}
我按字母读取的卡号只能读取第一行比如输入a,1的值没有问题。但是当我输入其它字母比如b c d等等却仍然是a组里的值,读取不到其它组的值。。。。希望有热心人能帮我,看看。我还试过把字母转换为数组下标数的写进另一个类,然后调用方法得到返回数。
我刚学JAVA的,没什么深度理解,写的东西可能让大家看着头疼,但是希望大家不要笑话我,不吝赐教,谢谢了!!
package WowInput;
import javax.swing.JOptionPane;
public class WowInput {
public static void main(String[] args) {
String input;
String [][]card ={
{"","26","23","01","67","84","67","78","99","21","73"},
{"","95","57","14","24","73","92","91","00","54","75"},
{"","24","65","05","68","17","17","00","68","26","63"},
{"","68","88","51","30","89","39","05","90","62","28"},
{"","33","31","83","76","42","11","16","08","89","56"},
{"","77","22","51","23","17","02","78","99","90","11"},