第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

提供一下個(gè)人的解題思路

http://img1.sycdn.imooc.com//5f5d00770001e9d104470188.jpg

網(wǎng)頁(yè)寫(xiě)的好像沒(méi)辦法讀取用戶數(shù)據(jù) 然后我用idea寫(xiě)了一下代碼? 因?yàn)闀r(shí)間原因只測(cè)試了部分月份? 隨便看看吧??

剛看教程作者的視頻自學(xué)了兩天java 按之前學(xué)的C#思路做的 感覺(jué)大差不差?

如果誤導(dǎo)大家的話請(qǐng)少罵 只是提供一下個(gè)人的解題思路

粗體為自己的方法 非粗體為作者自帶的代碼

System.out.print("您要開(kāi)始第幾周學(xué)習(xí)啦,直接輸入數(shù)字吧:");

//設(shè)置變量存儲(chǔ)接收到的數(shù)據(jù)

int?Week?= new Scanner(System.in).nextInt();//定義星期的接收變量
System.out.println("以下是您本月的學(xué)習(xí)計(jì)劃, √ 代表當(dāng)周學(xué)習(xí)任務(wù)");
System.out.println("=======================================");
//利用for循環(huán),找到數(shù)組中對(duì)應(yīng)這個(gè)月的內(nèi)容輸出

int Month = (Week*7)/30+1;//轉(zhuǎn)換月份

for(int i =1;i<contentList.length+1;i++)//從1開(kāi)始循環(huán)35次(35周)
{
????????if((i*7)/30+1 >=Month && (i*7)/30+1<(Month+1))//篩選符合本月的星期
????????{
????????????????if(i==Week)//在輸入的星期前打√
????????????????{
????????????????????System.out.print("√");
????????????????}
????????????????System.out.println(contentList[i-1]);//輸出符合條件的星期
????????}
}



正在回答

1 回答

import?java.util.Scanner;
public?class?HelloWorld{
????public?static?void?main(String[]?args)?{
????????//創(chuàng)建String數(shù)組,并為每一個(gè)元素賦值。賦值內(nèi)容為第幾周+學(xué)習(xí)內(nèi)容
????????String[]?contentList?=?new?String[35];
????????contentList[0]?=?"【第1周】環(huán)境搭建與語(yǔ)法入門(mén)";
????????contentList[1]?=?"【第2周】Java語(yǔ)法之循環(huán)、數(shù)組與方法";
????????contentList[2]?=?"【第3周】面向?qū)ο笾庋b與繼承";
????????contentList[3]?=?"【第4周】面向?qū)ο笾畣卫J脚c多態(tài)";
????????contentList[4]?=?"【第5周】常用工具類(上)";
????????contentList[5]?=?"【第6周】常用工具類(下)";
????????contentList[6]?=?"【第7周】常用工具類(下)";
????????contentList[7]?=?"【第8周】前端基礎(chǔ)之HTML與CSS";
????????contentList[8]?=?"【第9周】前端基礎(chǔ)之JavaScript與綜合案例";
????????contentList[9]?=?"【第10周】Java?Web基礎(chǔ)";
????????contentList[10]?=?"【第11周】Java?Web基礎(chǔ)";
????????contentList[11]?=?"【第12周】常用功能與過(guò)濾器";
????????contentList[12]?=?"【第13周】監(jiān)聽(tīng)器與項(xiàng)目實(shí)戰(zhàn)";
????????contentList[13]?=?"【第14周】監(jiān)聽(tīng)器與項(xiàng)目實(shí)戰(zhàn)";
????????contentList[14]?=?"【第15周】MySQL基礎(chǔ)";
????????contentList[15]?=?"【第16周】MySQL基礎(chǔ)";
????????contentList[16]?=?"【第17周】Java數(shù)據(jù)庫(kù)開(kāi)發(fā)基礎(chǔ)";
????????contentList[17]?=?"【第18周】框架前置知識(shí)";
????????contentList[18]?=?"【第19周】MyBatis基礎(chǔ)";
????????contentList[19]?=?"【第20周】MyBatis實(shí)現(xiàn)OA系統(tǒng)項(xiàng)目實(shí)戰(zhàn)";
????????contentList[20]?=?"【第21周】MyBatis實(shí)現(xiàn)OA系統(tǒng)項(xiàng)目實(shí)戰(zhàn)";
????????contentList[21]?=?"【第22周】Linux環(huán)境搭建與Redis應(yīng)用";
????????contentList[22]?=?"【第23周】Spring基礎(chǔ)";
????????contentList[23]?=?"【第24周】Spring基礎(chǔ)";
????????contentList[24]?=?"【第25周】Spring基礎(chǔ)";
????????contentList[25]?=?"【第26周】SSM開(kāi)發(fā)社交網(wǎng)站";
????????contentList[26]?=?"【第27周】Spring?Boot電商項(xiàng)目實(shí)戰(zhàn)";
????????contentList[27]?=?"【第28周】Spring?Boot電商項(xiàng)目實(shí)戰(zhàn)";
????????contentList[28]?=?"【第29周】面試";
????????contentList[29]?=?"【第30周】多線程與分布式";
????????contentList[30]?=?"【第31周】多線程與分布式";
????????contentList[31]?=?"【第32周】Spring?Cloud基礎(chǔ)";
????????contentList[32]?=?"【第33周】Spring?Cloud電商實(shí)戰(zhàn)";
????????contentList[33]?=?"【第34周】Spring?Cloud電商實(shí)戰(zhàn)";
????????contentList[34]?=?"【第35周】Zookeeper+Dubbo應(yīng)用與面試";

????????//提示信息
????????System.out.print("您要開(kāi)始第幾周學(xué)習(xí)啦,直接輸入數(shù)字吧:");
????????//設(shè)置變量存儲(chǔ)接收到的數(shù)據(jù)
????????int??inputnum?=?new?Scanner(System.in).nextInt();

????????//計(jì)算今天是幾月(1-月第一周、4-月第4周)
????????
????????//同時(shí)計(jì)算月和周
????????int?m,w;
????????if?(inputnum?%?4?!=?0?){
????????????m?=?inputnum?/?4?+?1;
????????????w?=?inputnum?%?4;
????????}else{
????????????m?=?inputnum?/?4;
????????????w?=?4;
????????}
????????
????????//為下面for提供起始值
????????int?startnum;
????????if?(inputnum?>?3)?{
????????????startnum?=?inputnum?-?4;
????????}else?{
????????????startnum?=?0;
????????}
????????
????????if?(inputnum?>?35)?{
????????????System.out.println("以超出課程范圍");
????????????System.exit(0);
????????}
????????
????????//提示信息
????????System.out.println("以下是您本月的學(xué)習(xí)計(jì)劃,?√?代表當(dāng)周學(xué)習(xí)任務(wù)");
????????System.out.println("=======================================");
????????System.out.println("已學(xué)習(xí)了"+?m?+?"個(gè)月,第"?+?w?+?"周!");
????????
????????//利用for循環(huán),找到數(shù)組中對(duì)應(yīng)這個(gè)月的內(nèi)容輸出
????????for?(int?i?=?startnum;?i?<?startnum+4;?i++)?{
????????????
????????????//根據(jù)當(dāng)前月第幾周,在輸出此行時(shí),前面添加“√”
????????????if?(i?==?inputnum-1)?{
????????????????contentList[inputnum-1]?=?"√"?+?contentList[inputnum-1];
????????????}?????????????
????????????System.out.println(contentList[i]);????????????
????????}???
}
}




直接在網(wǎng)頁(yè)上面不成功,?提示Scanner問(wèn)題,?本機(jī)測(cè)試成功


0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

慕少1370522

每個(gè)月不是固定的四周,這種寫(xiě)法會(huì)造成運(yùn)行結(jié)果的錯(cuò)誤。比如第17周,應(yīng)該是第四個(gè)月的第五周,但是按這種寫(xiě)法是第五個(gè)月的第一周,其實(shí)是不對(duì)的。
2020-09-27 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
Java入門(mén)第一季(IDEA工具)
  • 參與學(xué)習(xí)       1168181    人
  • 解答問(wèn)題       18754    個(gè)

0基礎(chǔ)萌新入門(mén)第一課,從Java環(huán)境搭建、工具使用、基礎(chǔ)語(yǔ)法開(kāi)始

進(jìn)入課程

提供一下個(gè)人的解題思路

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)