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

歡迎光臨散文網(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)的評論 (共 條)

分享到微博請遵守國家法律
黑水县| 开封县| 南澳县| 双城市| 肥城市| 海林市| 板桥市| 天全县| 句容市| 和田市| 汝城县| 金塔县| 临泽县| 安溪县| 台北市| 湘乡市| 江华| 察隅县| 南丰县| 永济市| 高邑县| 新丰县| 瓦房店市| 乳源| 疏勒县| 资讯 | 斗六市| 锦屏县| 宁都县| 邵阳市| 惠来县| 毕节市| 漯河市| 大埔区| 铁岭市| 宿迁市| 靖江市| 泰兴市| 乌什县| 碌曲县| 广德县|