All right.
So how would we modify this application where we are now checking for the age of the user.
And then we're also checking whether they are with parents or not.
So here we're going to modify our code a little bit.
So here we're going to say that the age will be console dot read line.
And here we're reading the input of the user.
And now we need to convert that into or parse that into a string.
So we're going to parse our console read line statement into a string in order to then keep the age
in there.
So now we also need to ask the user about their age.
So how old are you?
Then we can go ahead and use this is with parents and overwrite it accordingly based on what they say.
So here I'm going to use this if statement first of all to check whether they are older than 13.
And actually let's check if they are older than 18 first because I think this if block will make more
sense.
So here I'm going to say if age above 18 we don't need to ask for their whether they are with their
parents or not.
So go party in the club.
And then we're going to say else if they are older than 13, then we want to ask whether they are with
their parents or not.
So I'm going to do it like so.
So if they are 13 now, we're using a technique that we haven't covered yet, but I'm going to show
you in this video.
So there are other ways to do it as well.
I just want to show you a very like efficient way, so to speak, because we don't want to ask the user
about their parents if they don't have the right age.
So if they're, let's say over 18, they don't need to go with their parents.
So here I'm going to then use the Is with parents and make that dependent on whether the person said
yes or no.
So Console.WriteLine.
Are you with your parents question mark.
And then I'm going to use and here we need to make sure that we add the semicolon console dot read line.
And I'm just going to add in here answer with y or n okay.
So answer with yes or no.
So we're getting the user input.
And then we can store that inside of a string.
So we can say string is with parents.
String is going to be whatever the user has entered here.
And then we can check if is with parent string is equal to yes.
And if that's the case and I need to add the if statement here.
So if is with parents string here we need to use the double equals sign.
And then if they said yes then they can go party.
Otherwise they can't.
So go party with your parents and else no party for you.
So CW no party for you today.
Okay, so let's look at this step by step.
What did I do.
So I asked the user how old they are.
Then I got the age from the console.
So I'm reading out the console.
The user enters their age and maybe we add right a whole number.
Then we have this boolean which we set up and we by default set it to false, which we don't have to
because by default it will be false either way.
Right.
But just to make it clearer, we have it here.
Then we're checking if the person is above 18.
If they are you can go into the club directly.
If they aren't, then we're checking if there are at least 13 years old.
If they are at least 13 years old, we're asking them whether they are with their parents or not, and
we ask them to answer with yes or no.
So then we're basically saying, okay, get the user input and store it.
Inside of this variable is with parents string.
Now you could have modified this and put it all into one line.
But let's keep it as this.
Then we have another if statement in here where we say is with parents string, whether that's equal
to yes or two y.
If that's the case then the person code can go party.
And if that's not the case then the person cannot go party.
And if the person is neither 18 nor older than 13, they can go and party inside of the kindergarten.
So let's run this application and let's say we are 16.
Then it says, are you with your parents?
Yes.
No, I'm going to say yes.
It says go party in the club with your parents.
So let me run this again and let's say I'm 16 again and this time I can enter whatever.
I can even enter this.
And it will just say, no party for you today because the N is just there for like.
To make sure that people really just enter these things.
But either way, even if you enter anything else, it will just say no party for you today, because
the only thing we're checking is whether the answer is a yes.
So a Y, so to speak, the letter Y okay.
And that's pretty much that.
So let's check again.
If we are 18 then it's still checking.
Wait a second.
So I need to add the equal sign here.
So let's say we are 18.
Go party in the club.
Thank you very much a.
Okay good.
So now let's have the final case.
Let's say we are six years old and it says says go party in the kindergarten okay.
And that's it for this video.
I hope you enjoyed it.
And I hope you also tried to do this exercise yourself.
Congratulations on finishing it in that case.
And see you in the next video.