展开全部
已完成,复制粘贴,采纳即636f707962616964757a686964616f31333337376362可。
public class IMEI
{
private static void checkIMEI ( String[] imei )
{
int even = 0, odd = 0;
for ( int i = 0; i
{
int me = Integer.parseInt (imei[i].trim ());
if (i % 2 == 0)
{
even += me;
}
else
{
String tmp = 2 * me + "";
for ( int j = 0; j
{
odd += Integer.parseInt (tmp.charAt (j) + "");
}
}
}
System.out.println ("The sum of the even-positioned digits is " + even);
System.out.println ("The sum of the digits in the doubled odd-positioned digits is " + odd);
int sum = even + odd;
if (sum % 10 == 0)
{
System.out.println ("This is a correct IMEI number because the sum of the sums (" + sum + ")\nis a multiple of 10.");
}
else
{
System.out.println ("This is not a correct IMEI number because the sum of the sums (" + sum + ")\n is not multiple of 10.");
}
}
public static void main ( String[] imei )
{
checkIMEI (imei);
}
}