protected double[] cpi = { 10, 10.1, 10.3, 11.6, 13.7, 16.5 }
protected CharSequence[] fromDate = {
"1914",
"1915",
"1916",
"1917",
"1918",
"1919"};
protected CharSequence[] toDate = {
"1914",
"1915",
"1916",
"1917",
"1918",
"1919"};
我正在尝试以下操作:
double factor = cpi[frmDate[k]] / cpi [toDate[k]];
我得到以下两个错误:
类型不匹配:无法从 CharSequence 转换为 int
类型不匹配:无法从 CharSequence 转换为 int
我想要做的是......如果选择fromDate
是 index = 2 并且toDate
是 index = 3 然后计算以下内容:
double factor = cpi[10.3] / cpi[11.6];