最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

作業(yè)代碼(非最優(yōu)

2019-11-04 04:03 作者:kands-code  | 我要投稿

import java.util.*;


public class njava06{

? public static void main(String[]args){

? ? //get imformation;

? ? System.out.println("Please enter your id :");

? ? Scanner in = new Scanner(System.in);

? ? String id = in.nextLine();

? ? int[] arr = new int[18];

? ? for (int i = 0;i < id.length();i++){

? ? ? String cup = String.valueOf(id.charAt(i));

? ? ? int num = Integer.parseInt(cup);

? ? ? arr[i] = num;

? ? }

? ? //computer the imformation;

? ? int year = 1000*arr[6]+100*arr[7]+10*arr[8]+arr[9];

? ? int month = 10*arr[10]+arr[11];

? ? int day = 10*arr[12]+arr[13];

? ? System.out.println("Please enter the year :");

? ? int nowYear = in.nextInt();

? ? System.out.println("Please enter the month :");

? ? int nowMonth = in.nextInt();

? ? System.out.println("Please enter the day :");

? ? int nowDay = in.nextInt();

? ? System.out.println("You born on "+year+"/"+month+"/"+day);

? ? //make a choice and print out;

? ? if(nowMonth == month){

? ? ? if(nowDay >= day){

? ? ? ? int age = nowYear - year;

? ? ? ? System.out.println("You are "+age+"years old.");

? ? ? }

? ? ? else{

? ? ? ? int age = nowYear - year -1;

? ? ? ? System.out.println("You are "+age+"years old.");

? ? ? }

? ? }

? ? else if(nowMonth > month){

? ? ? int age = nowYear - year;

? ? ? System.out.println("You are "+age+"years old.");

? ? }

? ? else{

? ? ? int age = nowYear - year -1;

? ? ? System.out.println("You are "+age+"years old.");

? ? }

? ? if(arr[16]%2 == 0){

? ? ? System.out.println("You are female");

? ? }

? ? else{

? ? ? System.out.println("You are male");

? ? }

? ? //get the code of imformation;

? ? int point = 0;

? ? for(int i = 0;i < id.length();i++){

? ? ? int b = arr[i]*((int)(java.lang.Math.pow(2,i))%11);

? ? ? point += b;

? ? }

? ? int codeInf = point%11;

? ? System.out.print("The code imformation is ");

? ? if(codeInf == 0){

? ? ? System.out.print(1);

? ? }

? ? else if(codeInf == 1){

? ? ? System.out.print(0);?

? ? }

? ? else if(codeInf == 2){

? ? ? System.out.print('X');

? ? }

? ? else{

? ? ? System.out.print(12-codeInf);?

? ? }

? }

}


作業(yè)代碼(非最優(yōu)的評論 (共 條)

分享到微博請遵守國家法律
喀什市| 娄烦县| 聂荣县| 英山县| 阳朔县| 婺源县| 盐源县| 若羌县| 辽阳县| 北流市| 海口市| 湘潭市| 郯城县| 庆安县| 肃宁县| 东明县| 温泉县| 慈溪市| 汽车| 巴东县| 安西县| 乌兰县| 尼木县| 天祝| 阿克陶县| 女性| 临桂县| 河南省| 甘孜县| 大新县| 西丰县| 正阳县| 连城县| 寿光市| 鄂州市| 南宁市| 赫章县| 葵青区| 来宾市| 内丘县| 广安市|