freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

[it認(rèn)證]java考試題庫(kù)-文庫(kù)吧

2024-12-23 18:46 本頁(yè)面


【正文】 5 or 6 ? + isDivisibleOr(num) + \nIs + num + divisible by 5 or 6 , but not both ? + isDivisible(num)。 (null,output)。 } private static boolean isDivisible(int num){ if(num%5==0 ^ num%6==0) return true。 else return false。 } private static boolean isDivisibleBoth(int num){ if(num%5==0 amp。amp。 num%6==0) return true。 else return false。 } private static boolean isDivisibleOr(int num){ if(num%5==0 || num%6==0) return true。 else return false。 } } 14. 編寫(xiě)程序,讀入資金額(現(xiàn)值)、年利率和年數(shù),顯示終值(將來(lái)的資金額),計(jì)算公 式如下: 終值 = 現(xiàn)值 * ( 1+年利率)年數(shù) 15 (三個(gè)整數(shù)排序)編寫(xiě)程序?qū)θ齻€(gè)整數(shù)排序。整數(shù)由輸入對(duì)話框讀入,并分別存入變量 num num2 和 num3,對(duì)它們進(jìn)行排序,使得 num1=num2=num3。 import 。 public class Exercise3_8{ public static void main(String[] args){ int num1,num2,num3,temp。 num1 = ((null,輸入第一個(gè)數(shù): ))。 num2 = ((null,輸入第二個(gè)數(shù): ))。 num3 = ((null,輸入第三個(gè)數(shù): ))。 String output = num1 + , + num2 + , + num3。 if(num1num2){ temp = num1。 num1 = num2。 num2 = temp。 } if(num1num3){ temp = num1。 num1 = num3。 num3 = temp。 } if(num2num3){ temp = num3。 num3 = num2。 num2 = temp。 } output += 排序的結(jié)果是: \n + num1 + , + num2 + , + num3。 (null,output)。 } } 16 (計(jì)算三角形的周長(zhǎng))編寫(xiě)程序,讀入三角形的三邊,如果輸入有效,計(jì)算它的周長(zhǎng);否 則,顯示 輸入無(wú)效。如果任意兩邊的和大于第三邊,輸入有效。 import 。 public class Exercise3_9{ public static void main(String[] args){ double side1,side2,side3。 boolean isTriangle = false。 side1 = ((null,輸入第一條邊長(zhǎng): ))。 side2 = ((null,輸入第二條邊長(zhǎng): ))。 side3 = ((null,輸入第三條邊長(zhǎng): ))。 isTriangle = ((side1 + side2 side3)amp。amp。(side1 + side3 side2)amp。amp。(side2 + side3 side1))。 if(isTriangle) (null, 三 角 形 的 周 長(zhǎng) 為 : + (side1+side2+side3))。 else (null,輸入的數(shù)據(jù),不能組成三角形 )。 } } 17 (查找當(dāng)月的天數(shù))編寫(xiě)程序,提示用戶(hù)輸入年和月,而后顯示該月的天數(shù)。例如,如果用戶(hù) 輸入 2022 年 2 月時(shí),應(yīng)該顯示 2022 年 2 月有 29 天。如果用戶(hù)輸入 2022 年 3 月時(shí),應(yīng)該顯示 2022 年 3 月有 31 天。 import 。 public class Exercise3_11{ public static void main(String[] args){ int day = 0。 int year = ((輸入年份: ))。 int month = ((輸入月份: ))。 boolean isLeapYear = ((year % 4 == 0 amp。amp。 year % 100 != 0)||(year% 400 == 0))。 if(isLeapYear amp。amp。 month == 2) day = 29。 else if(month==4||month==6||month==9||month==11) day = 30。 else if(month==2) day = 28。 else day = 31。 String output = year + 年 + month + 月有 + day + 天 。 (null,output)。 } } 18 (統(tǒng)計(jì)正數(shù)和負(fù)數(shù)的個(gè)數(shù)并計(jì)算這些數(shù)的平均數(shù))編寫(xiě)程序,讀入個(gè)數(shù)不確定的整數(shù),求出讀人的 正數(shù)和負(fù)數(shù)個(gè)數(shù),并計(jì)算它們的總和及平均值, 0 不參與計(jì)數(shù)。當(dāng)輸入為 0 時(shí), 程序結(jié)束。將平均值作為一個(gè)浮點(diǎn)數(shù)來(lái)顯示。(例如,如果輸入 2 和 0,平均值應(yīng)當(dāng) 為 。) import 。 public class Exercise4_2 { public static void main(String[] args){ int sum = 0,count1 = 0,count2 = 0,num。 String output = 。 while(true){ num = ((輸入整數(shù)求平均數(shù),以 0 為結(jié)束標(biāo)志 ))。 if(num == 0) break。 sum += num。 output += num + , 。 if(num 0) count1 ++。 else count2 ++。 } output += 的平均數(shù)為: + (double)sum/(count1 + count2) + \n 正數(shù)的個(gè)數(shù)為: + count1 + \n 負(fù)數(shù)的個(gè)數(shù)為: + count2。 (null,output)。 } } 19 (千克轉(zhuǎn)換成磅)編一個(gè)顯示下列表格的程序(注意, 1 千克為 磅): 千克 磅 1 3 197 199 public class Exercise4_3 { /** * @param args */ public static void main(String[] args) { // TODO Autogenerated method stub (\t 千克 \t 磅 )。 for(int i = 1。i 200。 i += 2){ (\t + i + \t + (int)(i**10)/)。 } } } 20 (英里轉(zhuǎn)換成千米)編一個(gè)顯示下列表格的程序(注意, 1 英里為 千米): 英里 千米 1 2 ... 9 10 package eayang public class Test44 { /** * @param args */ public static void main(String[] args) { // TODO Autogenerated method stub (\t 英里 \t 千米 )。 for(int i=1。i=10。i++) { (\t+i+\t+(i*)) 。 } }} 21 (千克與磅互換〉編寫(xiě)一個(gè)程序,并排顯示下列兩個(gè)表格 (注意, 1 千克為 磅 ): 千克 磅 磅 千克 1 2 . 2 20 3 25 ... 197 510 199 515 package eayang。 public class Test45 { /** * @param args */ public static void main(String[] args) { // TODO Autogenerated method stub (\t 千克 \t 磅 \t 磅 \t 千克 )。 for(int i=1,n=20。i=200。i+=2,n+=5) { (\t + i + \t + (int)(*i*100)/)。 (\t + n + \t + (int)(n/*100)/)。 } } } 22 (英里與千米互換)編寫(xiě)一個(gè)程序,并排顯示下列兩個(gè)表格(注意, 1 英里為 千米 ): 英里 千米 千米 英里 1 20 2 25 ... 9 60 10 65 package eayang。 public class Test46 { /** * @param args */ public static void main(String[] args) { // TODO Autogenerated metho
點(diǎn)擊復(fù)制文檔內(nèi)容
試題試卷相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1