All right, so let's get started building our quiz app.
Therefore I'm going to create a new project.
It will be a console application.
And I'm going to call this one my quiz app.
And then I'm going to leave that checkbox in here.
If you don't have it, put it in there because we want to program correctly here with our internal class
program instead of being directly in the main method.
Okay.
So the first thing that we're going to need is the questions.
So we need to know how a individual question is going to look like so that we can create an array of
questions that we can then pass on to our quiz, so that it actually displays those questions and knows
which one of those answers that we're going to give is correct.
So let's go ahead and create a new class which I'm going to call question.
Question dot CSS will be a class.
And let's click on add.
So what do we need inside of this question.
And by the way I'm going to look over to the other side of the screen.
Don't worry about it I just have everything prepared here.
It will make it a lot easier for me to give you the best possible learning experience.
Okay, so what do we need to know about the question?
Well, we need to know what we want to display.
So the question text so to speak.
Then we need to know which possible answers we want to display.
And then we also need to know which of the answers is going to be the correct answer okay.
So let's create all of those three properties that we're going to require.
And I'm just going to create default props here.
One will be string and question text.
Then I'm going to have another one prop.
And this one will be a string array of answer.
And now answers.
You could go ahead and say okay you're going to create an extra class for answers as well.
But I think it would be too much here because I think strings are good enough for this particular situation.
And then another property which will take care of the correct answer index.
So what is the correct answer index.
Well that's basically the number in the array answers which is going to be the correct answer.
So we need to know for each question out of the four answer possibilities for example which of those
four is correct.
And the answers variable here is an array.
So we're going to use the index of the correct answer.
So for example if we have four answers the first answer will be at index zero.
The second answer will be at index one and the third one at index two and so forth.
Right.
And we need to know at which index the correct answer is, which is why we called this one correct answer
index because it doesn't start counting at one, it starts counting at zero.
So then we are going to need a constructor okay.
So I'm going to create a setter a constructor which is going to require all of those things.
Like we need to pass the question text that we want to display.
We need to pass the answers that we want to display or yeah, we want to display as well.
And we need to know which of the answers is the correct answer.
So here we can just go ahead and say question text then string array which will be answers.
And finally we're going to have an int.
And I'm going to call this one correct answer index okay.
Same question pretty much.
And then we can go in here and just say okay question index is going to be whatever the question index
is.
Then answers is going to be whatever answers you're going to give me.
And finally the correct answer index is going to be whatever you pass me as the correct answer index.
So that's our question already.
Now what we will add into the question as well is going to be one boolean method okay.
So I'm going to have one method public bool is correct answer.
So you could have also called it validate answer or whatever.
But I'm just going to say is correct answer where I'm going to take the user's choice and check is it
correct or not?
Now what this method will do is it will need to return a bool and you can see it here.
Already it says correct answer index equal equal choice.
So both directions are fine.
But this is basically what we want to know.
We want to know is whatever the user has entered as the int into this method is correct answer.
Is it the same int then the correct answer index okay.
And if that's the case, then we know that the answer is correct.
In all other cases we know that the answer is incorrect okay.
So that's.
It's going to be pretty much it for our question class.
Now in the next video, we're going to look at the quiz class.
And we'll probably need more than one video to finish the quiz class because there is a lot going on
in it.
Okay, so that's pretty much it for this video.
See you in the next one.