Building a Multiple Choice Quiz | Java | Tutorial 29

  Рет қаралды 235,025

Giraffe Academy

Giraffe Academy

Күн бұрын

Пікірлер: 150
@Eizuuu
@Eizuuu 2 жыл бұрын
you are literally better at explaining code than my "professional" college prof. I feel like I should be paying you instead of him.
@SupreethM
@SupreethM 5 жыл бұрын
alternate code: public class mcq1 { public static void main(String[] args) { Scanner type = new Scanner(System.in); int score=0; String q1= "what color are apples? " +"(a)red (b)blue "; System.out.println(q1); String ans1=type.nextLine(); if(ans1.equals("a")){ score++; } String q2= "what color are bananas? " +"(a)red (b)yellow "; System.out.println(q2); String ans2=type.nextLine(); if(ans2.equals("b")){ score++; } System.out.println("you have scored:"+score+"/2"); } }
@bonzaii61
@bonzaii61 2 жыл бұрын
Appreciate this man
@enlightened7354
@enlightened7354 2 жыл бұрын
Procedure way of writing in your future projects will you, fuck. Up.
@ToastOfTheUndeadOFF
@ToastOfTheUndeadOFF 2 жыл бұрын
appreciate this, gonna use this as a skeleton for my code
@VentusAstra
@VentusAstra Жыл бұрын
thank u so much!!
@AyshaFilms
@AyshaFilms 3 жыл бұрын
Just found this gem of a tutorial, thank you it simple to understand! Im new to coding, this taught me a lot
@ranjanadissanayaka5390
@ranjanadissanayaka5390 6 ай бұрын
this is very creative. And extremely well explained. Thanks so much Mike.
@juniorr_gomez
@juniorr_gomez 6 жыл бұрын
Can you put a tutorial on this similar topic but using ArrayList
@peacekeepermoe
@peacekeepermoe 6 жыл бұрын
Thanks for this video I managed to get most of my assignment done by following this :D
@Maen963
@Maen963 4 жыл бұрын
Well copying assignments doesn't make a good programmer !
@Sofiacchi
@Sofiacchi 6 жыл бұрын
Hi! I tried doing this, but i created an array for the questions and another one for the answers. At 12:13 I put it inside a for loop so i could do "new Questions(questionsarray[i], answersarray[i])" but then i can't do the "takeTest(questions)" part cause it doesn't recognize the questions variable. I tried inicializing it in other ways but there's always an error. How should i do it, any advice? Thanks
@lucasizquierdo7649
@lucasizquierdo7649 6 жыл бұрын
NGL you just made something so complicated seem so simple... Thank you :)
@renecabuhan1675
@renecabuhan1675 4 жыл бұрын
Yeah I notice that as wll
@AelroeZewdie
@AelroeZewdie Жыл бұрын
Thank you, no seriously thank you, I just finished my assignment because of this
@bellalahyoussef4035
@bellalahyoussef4035 5 жыл бұрын
this guy is awesome ,he makes everything look so easy! thank you man you saved my ass
@JudePhilips
@JudePhilips 4 жыл бұрын
On the off chance you see this because this comment is almost 4 years late, I would like to let you know your series of c++ and java are fantastic.
@falgunijaitly1782
@falgunijaitly1782 2 жыл бұрын
Hi Mike! You are doing absolutely amazing. Please keep up. I am going through all your tutorials however for this one I have a question. Would this be an example of abstraction or encapsulation? Under which OOPs principle this falls under? And how?
@hadr1an914
@hadr1an914 2 жыл бұрын
Thanks for this tutorial, it greatly helped my output test!
@utjitaanitamunamava2281
@utjitaanitamunamava2281 4 жыл бұрын
I like the way you teach Java thank you very much you came to rescue me
@goico6223
@goico6223 5 жыл бұрын
source code? your website does not display
@simpleguy7912
@simpleguy7912 3 жыл бұрын
you find it or not
@fengshili5624
@fengshili5624 4 жыл бұрын
Hi,I have some problem creating 20 questions quiz game.I can't define my variable.can you help me with that.thanks!
@alidabot6022
@alidabot6022 6 жыл бұрын
Hi! Can you please put out a tutorial on the same topic but in JFrames with designing
@raomuhammadusama9244
@raomuhammadusama9244 4 жыл бұрын
I'm Building a Quiz Management System using JFrame Form in netbeans if you're interested I'll let you see
@hyungminkim6664
@hyungminkim6664 4 жыл бұрын
Gaming Hype yes please
@raahimanil1719
@raahimanil1719 4 жыл бұрын
@@raomuhammadusama9244 pls share the System
@thelawgameplaywithcommenta2654
@thelawgameplaywithcommenta2654 2 жыл бұрын
I added additional if statements to give different responses to varying scores.
@asniceful
@asniceful 4 жыл бұрын
Hi Mike, Great work with your Java tutorials. I was just wondering why you chose double quote for the answer a ("a") instead of single quotes ('a') since 'a' is a character.
@williamselinder9138
@williamselinder9138 3 жыл бұрын
Im no pro here, and you probably know why already, but I think its because its a string and not a character.
@wasifshahzad5001
@wasifshahzad5001 3 жыл бұрын
ya me too, by using character we could've even saved up memory
@azudora8255
@azudora8255 2 жыл бұрын
Thanks for the tutorial! This is more understandable than how my prof teaches
@k-universe0022
@k-universe0022 4 ай бұрын
great explanation 👏
@gennilynpanizares1557
@gennilynpanizares1557 Жыл бұрын
This really helps me a lot thank you so muchhh
@bittushah9311
@bittushah9311 6 жыл бұрын
Thank You! It is worth to have such video. It helped me a lot. Once again Thank You!.
@kifter4254
@kifter4254 5 жыл бұрын
Thank you man. You should do a java tuotorial for beginners. Would be amazing.
@scottisitt
@scottisitt 4 жыл бұрын
I added messages to the score checker: if(answer.equals(questions[i].answer)) { System.out.println("Nice!"); score++; }else { System.out.println("Nope!"); } Also added different messages depending on your score. if(score == questions.length) { System.out.println("You got " + score + " out of " + questions.length + "! Nice job!"); }else if(score < questions.length && score > 0) { System.out.println("You got " + score + " out of " + questions.length + "! Not bad."); } else { System.out.println("You got " + score + " out of " + questions.length + "! That's a crap score!"); }
@Samiullah-sk6er
@Samiullah-sk6er 7 жыл бұрын
Thanks A lot For giving such code idea !
@daniellecruz3311
@daniellecruz3311 2 жыл бұрын
This is awesome. Thank you very much.
@geriatricmillenial1983
@geriatricmillenial1983 6 жыл бұрын
hey great video just wanted to ask what the reason to create another class. Can I just have one class for this program?
@rezstrike
@rezstrike 5 жыл бұрын
did u find the answer to ur question ?
@SupreethM
@SupreethM 5 жыл бұрын
yes, you may have one class itself(personally consider it better), you do not have to create another. he might have created another class just for better understanding and to show how classes are used.
@marygracelabuan1616
@marygracelabuan1616 6 жыл бұрын
You're great ,thanks sir.
@jeffreywong3577
@jeffreywong3577 3 жыл бұрын
Thank you, Please keep up creating new videos
@xlsupermonkeylx6643
@xlsupermonkeylx6643 5 жыл бұрын
Is there a better way to do a questionnaire type thing that can accept user input and multiple-choice questions?
@inspirationalquotes5840
@inspirationalquotes5840 4 жыл бұрын
Thank you. That was helpful
@stefanopenrhyn6501
@stefanopenrhyn6501 6 жыл бұрын
Hi thanks for the video! It is very useful seeing the colours so you can easily identify the connections among the objects. Are you using a specific version of Java ?
@c123ian
@c123ian 6 жыл бұрын
he is using Eclipse, a program you use to write Java www.eclipse.org
@SupreethM
@SupreethM 5 жыл бұрын
you can change the colors in your own ide
@sritamabanerjee1331
@sritamabanerjee1331 4 жыл бұрын
Hello Mike ..Can we do the same in blue j ?
@ufotofu9
@ufotofu9 6 жыл бұрын
When you create an instance of the Question class, you made it an array. I wasn't aware that you could do that. Could you explain a bit more about creating class objects and using them as "data types"? I find it confusing.
@eagerassaultixopi4558
@eagerassaultixopi4558 5 жыл бұрын
same, have you figured it our yet ?
@shantb364
@shantb364 2 жыл бұрын
Questions: lets say for question 1 the answer was “a”, will it give a wrong answer if the user entered “A”? Because I’m not sure if case-insensitivity was coded.
@DriveBreakFixRepeat
@DriveBreakFixRepeat 2 жыл бұрын
Yes it will. Inside for the for loop when you accept the answer, do this: "String answer = scanner.nextLine().toUpperCase();" // or ".toLowerCase()" depending on how you write the code.
@peacekeepermoe
@peacekeepermoe 6 жыл бұрын
I couldn't find the source code for this exercise... Got a link to it somewhere?
@abdeljalil1841
@abdeljalil1841 4 жыл бұрын
thank you so much Mike
@itbrezel
@itbrezel 3 жыл бұрын
Hey Thank you very much for this amazing Video! I have one question: why do we have given the Question the attribute prompt? What kind of purpose does it have?
@coreyoneill7422
@coreyoneill7422 5 жыл бұрын
Can you upload the Source code? Website is not showing it.
@user-ne6iy4xz1u
@user-ne6iy4xz1u 5 жыл бұрын
thanks for teaching us
@jughnnneeelll
@jughnnneeelll 3 жыл бұрын
thanksss for thisss, but my problem is that how to use the try catch method using this?
@ericgoovaerts2603
@ericgoovaerts2603 3 жыл бұрын
how to print the two strings (prompt and answer) together? System.out.print( questions[x].prompt,answer) did not work ?
@har9106
@har9106 3 жыл бұрын
thank u , u saved my life
@markdalogdog1864
@markdalogdog1864 4 жыл бұрын
How to random the questions and answer?
@theencryptedpartition4633
@theencryptedpartition4633 Жыл бұрын
Don't we need like setters and getters for these?
@Leprolifique
@Leprolifique 5 жыл бұрын
please help? How can i use if/else statement to allow user to run program multiple times, otherwise pressing any other key to exit?
@ZombieNicolas
@ZombieNicolas 5 жыл бұрын
I think you what you need is a do{ "your program" }while(statment for leaving the program);
@SupreethM
@SupreethM 5 жыл бұрын
use a loop rather
@KJOB
@KJOB 5 жыл бұрын
tough questions you made there
@moon_wei
@moon_wei 3 жыл бұрын
is this done on BlueJ ?
@johnvincentgenobaten6402
@johnvincentgenobaten6402 2 жыл бұрын
how to make this questions with scoring in try-catch exceptions?
@anonymouscat02
@anonymouscat02 4 жыл бұрын
is there a way that i can get these questions randomly ordered?
@mrboyban
@mrboyban 3 жыл бұрын
just enter the random function
@jorelletuyor
@jorelletuyor 4 жыл бұрын
Can you please tell me the codes to be used upon applying it to GUI
@aneesfathima5803
@aneesfathima5803 4 жыл бұрын
On which software is the code written ?
@biswajitsahoo1456
@biswajitsahoo1456 4 жыл бұрын
U are a god for me brother
@mageshwars5191
@mageshwars5191 4 жыл бұрын
Ok....now how to make those list of questions appear in random order?....
@memoriser6533
@memoriser6533 4 жыл бұрын
thanks so much!
@fahrulrozi409
@fahrulrozi409 4 жыл бұрын
can you tell me how to make the questions appear randomly please?
@jughnnneeelll
@jughnnneeelll 3 жыл бұрын
can i also do this on java n-ide app?
@albinsopaj
@albinsopaj 4 жыл бұрын
What is the difference between a class type and a primitive data type? I don't see the difference?
@rahulpradhan5585
@rahulpradhan5585 6 жыл бұрын
great sir
@_GauriSanjayBarge
@_GauriSanjayBarge 2 жыл бұрын
where can i get the source code
@yomo2769
@yomo2769 6 жыл бұрын
If i wanted to print a variable for a score how would i do that
@SupreethM
@SupreethM 5 жыл бұрын
score is the variable
@veneraantiquar7214
@veneraantiquar7214 4 жыл бұрын
Hi, can you please make a tutorial on the same topic but instead of for loop could you please do it in a try-catch block?
@breadnobones
@breadnobones 4 жыл бұрын
yo sameeeeeeed
@jorelletuyor
@jorelletuyor 4 жыл бұрын
How can I apply this code into GUI?
@jezzymallo4390
@jezzymallo4390 2 жыл бұрын
This helped
@muktarulhossain5425
@muktarulhossain5425 5 жыл бұрын
Which IDE best for java project?
@SupreethM
@SupreethM 5 жыл бұрын
eclipse netbeans
@kifter4254
@kifter4254 5 жыл бұрын
How would you do this, if the questions are picking randomly because you I have to use math. random to make the computer pick out a random 10 questions from a total 20. How Would i make them check if the answer is right then? Because question 1 isnt the same question all the time
@thanapongangkha1417
@thanapongangkha1417 5 жыл бұрын
You would have to create 20 question objects. Since every object has their own prompt and answer , you just simply use Random class (google it, it's not hard to use) to random number in the range of 20 using nextInt() method and put it in the loop(so it will random new number everytime we pass the loop), in for loop you would use a random number as an index of the question array then do exactly like Mike did. And if you want the user to answer 10 questions, just tell for loop to loop 10 times. Hope this helps.
@simpleguy7912
@simpleguy7912 3 жыл бұрын
where is the code please send the link
@bomjex
@bomjex 6 жыл бұрын
thanks for your tutorial. I have a question: How do I put and else statement so, if the answer is wrong the system says: try again. Because the method is void and don't allow to introduce a return statement. I removed the void from the method and wrote the else return but doesnt work. Can you help please
@thanapongangkha1417
@thanapongangkha1417 5 жыл бұрын
Have you got the answer yet? If not, you don't have to return anything. You can just use System.out.println("try again"); to display the message. Only return something when you want to store it to use later.
@SupreethM
@SupreethM 5 жыл бұрын
use System.out.println("try again"); under else
@SupreethM
@SupreethM 5 жыл бұрын
use a while statement for it to loop back to make the user try again, but then it will loop until the user gets it correct
@hollownights6469
@hollownights6469 4 жыл бұрын
How do I get the percentage?
@landylandinha38
@landylandinha38 4 жыл бұрын
Hi Mike, how can I display true and false
@twosongs7396
@twosongs7396 3 жыл бұрын
This feature would have to be part of your conditional. Example: if answer = questions[i.answer] println “String True!” Else println “String False, try again” or “String False, better luck next time” or stg like that....
@banqueen9007
@banqueen9007 4 жыл бұрын
How can i do that in 2d array?
@Karslo
@Karslo Жыл бұрын
Does anybody know why if we use "==" instead of equals it doesn't work? It works with other strings, but for some reason (even though they print the same character) answer is not == questions[i].answer
@franzkarlomartinez3493
@franzkarlomartinez3493 5 жыл бұрын
How to repeat or retake the quiz?
@Gracovitz
@Gracovitz 5 жыл бұрын
THere may be a "clear" button/option in the program that you are using for the project, if not, you can try and code a method that will reset the test once you've done it (maybe add a counter for the number of times you've done it).
@nikolasgestrich9598
@nikolasgestrich9598 3 жыл бұрын
what would I do if I have multiple correct answers for 1 question
@twosongs7396
@twosongs7396 3 жыл бұрын
Add an extra choice letter, say like “d) all of the above” or “d) b and c are correct” - simplest answer possible
@vanditasingh777
@vanditasingh777 3 жыл бұрын
where is source code?
@augh7287
@augh7287 4 жыл бұрын
The plus signs are the only signs that have error can someone help me fix this problem?
@bryanochoa2464
@bryanochoa2464 5 жыл бұрын
what if i input other letter/number in the answer. i mean how can i repeat the question if i did that? sorry for my english..
@thanapongangkha1417
@thanapongangkha1417 5 жыл бұрын
Hi. You can do that by using while loop (eg. While(true) ) and set the condition like this. if (!keyboardInput.equals("a") || !keyboardInput.equals("b") || !keyboardInput.equals("c")) ). Remember that !a.equals(b) means "a is NOT equal to b" and || means "or". The code above is to check if the input is equal to a, b, c or not. If not, keep getting the input till the user input one of them. In the else statement put "break;" to exit the loop when the user input one of them.
@SupreethM
@SupreethM 5 жыл бұрын
for such cases learn about "try and catch" it will make your code much better
@MMMMEEKK
@MMMMEEKK 5 жыл бұрын
This is OOP ??
@matrimanuel_791
@matrimanuel_791 4 жыл бұрын
I didn't understend very well the part of code of the parameters of takeTest. takeTest(questions); ^ public static void takeTest (Question [] questions) ^
@anusha0624
@anusha0624 6 жыл бұрын
How would I do this using JOption and Radio Buttons?? Anybody??
@ashwinibagali7658
@ashwinibagali7658 4 жыл бұрын
Which algorithm is used sir???
@jyotiprakash9186
@jyotiprakash9186 6 жыл бұрын
nice
@ahndreiybuscado5936
@ahndreiybuscado5936 3 жыл бұрын
Why does he put another public class? What's the purpose of that?
@jrick3086
@jrick3086 3 жыл бұрын
your codes is error
@BennyAshurov
@BennyAshurov 2 жыл бұрын
i am stuck please help
@kifter4254
@kifter4254 5 жыл бұрын
How would I do this using math.random
@boss_aj514
@boss_aj514 5 жыл бұрын
Same question here iwant the question to be in a random
@joelsiennicki3590
@joelsiennicki3590 4 жыл бұрын
recommend watching at 1.5 speed.
@boss_aj514
@boss_aj514 5 жыл бұрын
Can you make a vid for making a random question ?
@itswanadiaries
@itswanadiaries 3 жыл бұрын
it doesnt work
@kshitiz4336
@kshitiz4336 6 жыл бұрын
Java
@pranavacharya6728
@pranavacharya6728 5 жыл бұрын
error: non-static variable this cannot be referenced from a static context Question q[]={new Question(q1,"a"),new Question(q2,"b")}; ^ error: non-static variable this cannot be referenced from a static context Question q[]={new Question(q1,"a"),new Question(q2,"b")};
@ScienceLifeChronicles
@ScienceLifeChronicles 25 күн бұрын
2024 still here
@shahzainhaider2801
@shahzainhaider2801 4 жыл бұрын
Error in line public static void takeTest(Question[] questions){
@johnroth8585
@johnroth8585 2 жыл бұрын
questions
@majaprokic1514
@majaprokic1514 6 жыл бұрын
I love you
@devoiddude
@devoiddude 6 жыл бұрын
2:10 that's a constructor not a method!!!
@mallucanuck
@mallucanuck 4 жыл бұрын
a constructor is a method.
@somarble
@somarble 3 жыл бұрын
You gotta redo this lesson....hard to follow
@vanessamaebello2032
@vanessamaebello2032 2 жыл бұрын
I tried it but sadly, many errors occur 😩💔
@eye_hope8507
@eye_hope8507 2 жыл бұрын
mine got a lot of error i did what you did
Object & Instance Methods | Java | Tutorial 30
5:36
Giraffe Academy
Рет қаралды 80 М.
Java Multiple Choice Quiz Program Tutorial #31
13:06
Alex Lee
Рет қаралды 23 М.
Это было очень близко...
00:10
Аришнев
Рет қаралды 7 МЛН
Smart Sigma Kid #funny #sigma
00:14
CRAZY GREAPA
Рет қаралды 107 МЛН
風船をキャッチしろ!🎈 Balloon catch Challenges
00:57
はじめしゃちょー(hajime)
Рет қаралды 46 МЛН
Learn Any Programming Language In 3 Hours!
22:37
Code With Huw
Рет қаралды 509 М.
Building a Guessing Game | Java | Tutorial 20
12:57
Giraffe Academy
Рет қаралды 71 М.
Getters & Setters | Java | Tutorial 31
17:49
Giraffe Academy
Рет қаралды 111 М.
Java Quiz
1:01:50
Telusko
Рет қаралды 8 М.
Learn Java in One Video - 15-minute Crash Course
14:54
Coding with John
Рет қаралды 757 М.
Java quiz game ⌛
1:07:22
Bro Code
Рет қаралды 121 М.
Fastest Way to Learn ANY Programming Language: 80-20 rule
8:24
Sahil & Sarra
Рет қаралды 907 М.
Learn Java in 14 Minutes (seriously)
14:00
Alex Lee
Рет қаралды 4,8 МЛН
Java Tutorial GUI Building - NetBeans - Simple Quiz
35:22
TLDR Computer Science
Рет қаралды 14 М.
Multithreading in Java Explained in 10 Minutes
10:01
Coding with John
Рет қаралды 952 М.
Это было очень близко...
00:10
Аришнев
Рет қаралды 7 МЛН