Cov txheej txheem:
- Kauj ruam 1: Ntshuam
- Kauj Ruam 2: Teeb Txoj Hauv Kev Loj
- Kauj Ruam 3: Tshaj tawm lub Scanner
- Kauj Ruam 4: Tus Zauv Xaiv
- Kauj Ruam 5: Txheeb Rau Tus Zauv Ntawm Qhov Xaiv
- Kauj Ruam 6: Pib Pib Array
- Kauj Ruam 7: Ua Lub Loop
- Kauj Ruam 8: Xaiv Kev Xaiv
- Kauj ruam 9: Luam theej duab hauv Xaiv
- Kauj ruam 10: Tshaj tawm Random
- Kauj Ruam 11: Tsim Tus Zauv Random
- Kauj Ruam 12: Luam Ntawv Xaiv
- Kauj Ruam 13: Nrog koj zoo siab
Video: Java Choice Maker: 13 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
Cov txheej txheem qhia no yuav qhia yuav tsim lub program java li cas uas yuav ua rau xaiv los ntawm cov npe xaiv uas tau nkag los ntawm tus neeg siv. Kev paub ua haujlwm yooj yim ntawm java thiab IDE los tsim cov haujlwm hauv. Txhua kauj ruam yuav tsum siv sijhawm tsis pub ntau tshaj 2 feeb.
Kauj ruam 1: Ntshuam
Ntshuam lub scanner thiab Random chav kawm hauv java
ntshuam java.util. Scanner;
ntshuam java.util. Random;
Kauj Ruam 2: Teeb Txoj Hauv Kev Loj
Teeb tsa lub luag haujlwm tseem ceeb hauv java
pej xeem zoo li qub tsis muaj dab tsi tseem ceeb (Txoj hlua args) {}
Kauj Ruam 3: Tshaj tawm lub Scanner
Pib ua ntej thiab tshaj tawm qhov hloov pauv rau lub tshuab luam ntawv hauv qhov no kuv tau hu ua qhov hloov pauv tau
Scanner scan = scanner tshiab (System.in);
Kauj Ruam 4: Tus Zauv Xaiv
Qhia tus neeg siv rau tus lej ntawm kev xaiv.
Kauj Ruam 5: Txheeb Rau Tus Zauv Ntawm Qhov Xaiv
Siv lub tshuab ntsuas qhov ntsuas kom nkag mus rau tus lej ntawm cov kev xaiv thiab khaws cia hauv qhov sib txawv hauv qhov no numChoices
int numChoices = scan.nextInt ();
Kauj Ruam 6: Pib Pib Array
Pib ib qho array nrog ntau lub ntsiab lus raws li koj muaj kev xaiv hauv qhov no stringArray
Txoj hlua stringArray = Txoj hlua tshiab [numChoices+1];
Kauj Ruam 7: Ua Lub Loop
Sau rau lub voj siv lub txee pib rau 0 kom dhau los ntawm kab
rau (int kuv = 0; kuv <stringArray.length; kuv ++) {}
Kauj Ruam 8: Xaiv Kev Xaiv
Qhia tus neeg siv rau kev xaiv
Kauj ruam 9: Luam theej duab hauv Xaiv
Siv lub tshuab luam ntawv txhawm rau nkag koj cov kev xaiv rau hauv kab
stringArray [kuv] = scanner.nextLine ();
Kauj ruam 10: Tshaj tawm Random
Tshaj tawm qhov sib txawv rau qhov xwm txheej hauv qhov no nws yog lub npe rand (nco ntsoov ua qhov no sab nraum lub voj)
Random Random = tshiab Random ();
Kauj Ruam 11: Tsim Tus Zauv Random
Tsim tus lej random siv Rand thiab muab nws qhov sib txawv hauv qhov no randomChoice
int randomChoice = rand.nextInt (numChoices);
Kauj Ruam 12: Luam Ntawv Xaiv
Siv cov lej uas tsim los nyob rau hauv kab lus thiab luam tawm cov ntsiab lus ntawm qhov ntsuas ntawd
System.out.print (stringArray [randomChoice]);
Kauj Ruam 13: Nrog koj zoo siab
Koj yuav tsum muaj txoj haujlwm uas ntsuas hauv ntau qhov kev xaiv thiab luam tawm ib qho ntawm cov kev xaiv ntawd ntawm qhov xwm txheej.
Yog tias koj tau txais qhov ntsuas ntsuas tawm ntawm qhov tsis raug yuam kev txheeb xyuas koj lub voj voos. Nco ntsoov xyuas koj cov cai rau kev siv cov cim ib nrab. nco ntsoov tias java yog cov ntaub ntawv rhiab!
Pom zoo:
Arduino Tsheb Rov Qab Chaw Nres Tsheb Ceeb Toom - Cov Kauj Ruam ntawm Kauj Ruam: 4 Kauj Ruam
Arduino Tsheb Rov Qab Chaw Nres Tsheb Ceeb Toom | Cov kauj ruam ib kauj ruam: Hauv txoj haujlwm no, kuv yuav tsim qhov yooj yim Arduino Tsheb Rov Qab Tsheb Nres Tsheb Nres Sensor Siv Arduino UNO thiab HC-SR04 Ultrasonic Sensor. Qhov no Arduino raws Lub Tsheb Rov Qab ceeb toom tuaj yeem siv rau Kev Tshawb Fawb Txog Tus Kheej, Robot Ranging thiab lwm yam
Tsev Automation Kauj Ruam ntawm Kauj Ruam Siv Wemos D1 Mini Nrog PCB Tsim: 4 Kauj Ruam
Tsev Automation Kauj Ruam Ib Leeg Siv Wemos D1 Mini Nrog PCB Tsim: Tsev Automation Kauj Ruam los ntawm Kauj Ruam siv Wemos D1 Mini nrog PCB Tsim cov tub ntxhais kawm ntawv qib siab. Tom qab ntawd ib tus ntawm peb cov tswv cuab tuaj
RC Taug Qab Neeg Hlau Siv Arduino - Kauj Ruam Ib kauj ruam: 3 Kauj Ruam
RC Tracked Robot Siv Arduino - Kauj Ruam Ib Nrab: Hav guys, Kuv rov qab los nrog lwm tus neeg hlau txias chassis los ntawm BangGood. Vam tias koj tau dhau los ntawm peb cov phiaj xwm yav dhau los - Spinel Crux V1 - Tus Cwj Pwm Tswj Tus Neeg Hlau, Spinel Crux L2 - Arduino Xaiv thiab Muab Neeg Hlau nrog Robotic caj npab thiab Badland Braw
Kawm Yuav Ua Li Cas Kos Tus Tswm Ciab - Kauj Ruam Ib Kauj Ruam: 6 Kauj Ruam
Kawm Yuav Ua Li Cas Thiaj Li Tswmciab - Kauj Ruam Ib kauj ruam: Cov tswm ciab no siv sijhawm 10 feeb los kos yog tias koj ua raws kuv cov kauj ruam ua tib zoo
DIY Arduino Robotic Arm, Kauj Ruam ntawm Kauj Ruam: 9 Kauj Ruam
DIY Arduino Robotic Arm, Kauj Ruam ntawm Kauj Ruam: Cov ntawv qhia no yog qhia koj yuav tsim lub Caj Npab Caj Npab ntawm koj tus kheej li cas