Exercise 11 How to do it?


#1

I honestly do not know how to do this.


#2

You are going to have to post your code and the exercise URL for us to help.


#3

Yes, as @oscartbeamish said, when possible you do need to post your code and url to the exercise to help us help you. But if you just don't know what to do on a lesson and you haven't started yet that is ok too. Lets look at this step by step! :smiley:

1.) Use the precedence rules to help you evaluate the Boolean expression in the single line comment above the tricky variable.

Then, set the boolean variable tricky equal to the result (either true or false).
So basically, the instructions is asking you to evaluate this statement of your code: // ( 3 >= 3 && !(true || true) ) to see whether its true or false using past knowledge learned in previous lessons. Remember this is a review lesson so you are going to use a little bit of everything you have learned here. Once you evaluate that you want to simply do as it says: set the boolean variable tricky equal to the result (either true or false). So you should end up with something like this:

boolean tricky = whicheveriscorrect;

2.) Change the Boolean expression in the if statement so that your program will print out the code in the else block instead. So we are looking at this part of our code: if(2016 < 2015) { How can we change this so that our program will print out what is in the else block? Make that change and you are on your way to the final step.

3.) Set the value of the int variable subwayTrain equal to the case that will print "This is a Brooklyn bound train!" to the console.
This step should be simple enough. Right now int subwayTrain is equal to 9 which is not even a case we are given in our code. So we need to pick the case that says this is a Brooklyn bound train!

That brings us to the end of our coding journey in Conditionals and Control Flow! :smiley: Hopefully that helped you gain enough understanding of the general concepts of this lesson to help you pass it with flying colors! :thumbsup:


#4

thanks

wow........................


#5

No problem! haha glad to have helped! :smiley:


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.