Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
I have to break the following question down and solve and put it into a presentation step by step can anyone help please solve as I have no idea how to do it tank you.
"A complex mobile missile launch control system is controlled as follows:
If the conditions are right, the system will always launch unless told not to do so
The operator has two buttons: Cancel launch and Force launch
The missiles cannot be launched if the wind speed is over 60mph
The missiles will launch whenever an enemy target is detected as follows:
>500 miles away – launch long range missile
<250 miles away – launch short range missile
Between 500 and 250 miles away – launch both missiles
The system must be deployed in order to launch
If friendly target is detected do not launch
"
We don’t/can’t do homework questions for you (that’s considered cheating), sorry Sad

I would try to help, but I’d probably just give away the answer.
_iPhoenix_ wrote:
We don’t/can’t do homework questions for you (that’s considered cheating), sorry Sad

I would try to help, but I’d probably just give away the answer.


I don't think we'll be giving an answer, just helping them understand the problem.

So, The conditions are always Perfect.

We'll let the range to the target be X
We'll Let "Long Range" be Y
We'll Let "Short Range" be Z

If X > 500 Then Y
If X < 250 Then Z
If 250 < x > 500 Then Y + Z

We'll call this "GET_DISTANCE"
So, if X = 300, that's not less than 250 nor is it longer than 500. See:
300 < 250 = FALSE, 300 is actually GREATER THAN 250.
300 > 500 = FALSE, 300 is actually LESS THAN 500.
250 < 300 > 500 = TRUE. Both Short and Long are launched.

Let's now let 100 = X.
100 < 250 = TRUE
100 > 500 = FALSE
Short Range missile is launched.

Finally, 1000 = X.
1000 < 250 = FALSE
1000 > 500 = TRUE
Long Range missile is launched.

Now, we need to take in other conditions since as the wind speed and whether the target is enemy or friendly.


Code:
If (WIND_SPEED < 60)
Then
    If( Target = Enemy)
        GET_DISTANCE
    Else
        DO_NOT_LAUNCH
Else
    DO NOT LAUNCH
End


That's Boolean logic: IF this THEN that.
Alex wrote:
That's Boolean logic: IF this THEN that.


Boolean logic is about Boolean variables and Boolean operations (like NOT, OR, AND).

The pseudocode hides the operations, using multiple if/then conditional statements instead.

The acutal Boolean logic part is printed in bold:

IF WindVelocityLessThan60MPH
AND SystemIsDeployed
AND TargetIsDetected
AND (NOT TargetIsFriendly)
AND TargetDistanceLessThan500Miles
AND (NOT CancelLaunchButtonIsPressed)

THEN LaunchShortRangeMissile
Alex was correct.

The THIS and THEN parts are where those logical statements are used.

Example: If my username on this site is _iPhoenix_, and this site is callled “Cemetech”, then my username on Cemetech is _iPhoenix_.

That is a logical statement. (Logical meaning that it relates to logic, not necessarily that it makes sense)

The Boolean “truth value” of said statement is true, because my username on this site IS _iPhoenix_, this site IS called “Cemetech”, and my conclusion is true.
_iPhoenix_ wrote:
The THIS and THEN parts are where those logical statements are used.


I think he's more getting at the fact that I said those (IF, THEN) were Boolean logic. The way I phrased it explicitly excluded things like OR, AND, XOR, NOT, and any others that may be out there. It's true, I could have used more boolean operations - much like CtrEng did - to do the same thing.

This would be more succinct:

Code:
If (WIND_SPEED < 60) AND (Target = Enemy)
Then
    GET_DISTANCE
Else
    DO NOT LAUNCH
End
Pure Boolean logic would lack any IF/THEN statements, since it is about mathematical equations, e.g.

LaunchShortRangeMissile =
WindVelocityLessThan60MPH
AND SystemIsDeployed
AND TargetIsDetected
AND (NOT TargetIsFriendly)
AND TargetDistanceLessThan500Miles
AND (NOT CancelLaunchButtonIsPressed)

The equation could then be implemented as circuitry, as code, mechanically, etc.
Aha, you would be correct. My mistake. Though I would imagine it would have at least one IF statement, no?

LaunchShortRangeMissile IF
WindVelocityLessThan60MPH
AND SystemIsDeployed
AND TargetIsDetected
AND (NOT TargetIsFriendly)
AND TargetDistanceLessThan500Miles
AND (NOT CancelLaunchButtonIsPressed)
Thank you all for the answers the make a lot of sens , especially to you sir Alex your answer had been very useful, I like to thank you very much.

One last question , what is the best Boolean Logic site or book to get the knowledge from.


Thank you . Smile Smile Smile Smile Smile Smile
RR wrote:
One last question , what is the best Boolean Logic site or book to get the knowledge from.


I'm not sure if there's a dedicated site for this but we would be more than happy to answer any continuing and future questions.

I'm drawing a blank on a book. I'll do some book searching though.

Now, if you're a hands-on learner take a look at Minecraft. I know it gets a lot of publicity as a children's game but it does a pretty good job teaching Boolean logic. Through the games "redstone" wiring you can create logic gates that are effectively Boolean logic. If you don't want the game aspect of it, just enter the Creative Mode in a single player game and watch some youtube tutorials to get started. Practice by wiring levers to a light. Then add in AND gates, then the OR and NOT gates as well.
Alex wrote:
Aha, you would be correct. My mistake. Though I would imagine it would have at least one IF statement, no?


In (programming) practice, yes, but not necessarily in all cases.

If LaunchXYZmissile are variables, then an assignment would be all that is necessary.

Or, if you're deliberately trying to make your code incomprehensible, you could use the short-ciruit evaluation feature if your programming language has it (C does, for example).

RR wrote:

One last question , what is the best Boolean Logic site or book to get the knowledge from.


It should be covered in math/EE/CS textbooks as it is a really fundamental thing.
This is not and never was a programming question.

This was a math question.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement