Search code examples
javabooleanboolean-logicboolean-expressionboolean-operations

Boolean algebra in computer science


The problem is here. I don't have enough reputation to post the picture so here is the Imgur link: https://i.sstatic.net/6Zpwg.jpg


Solution

  • You should simplify the question by turning each condition to a variable.

    so, "(y > 10000) || (x > 1000 && x < 1500)"

    becomes (a) || (b && c)

    Use the distributive property...

    (a || b) && (a || c)

    Which makes the answer...

    "(y > 10000 || x > 1000) && (y > 10000 || x < 1500)"

    Which is Option "B".

    Hope this helps