(De Morgan’s Laws) In this chapter, we discussed the logical operators &&, &, | |, |, ^ and !. De Morgan’s laws can sometimes make it more convenient for us to express a logical expression. These laws state that the expression ! (condition1 && condition2) is logically equivalent to the expression (! Condition1 | | ! condition2). Also, the expression ! (condition1 \ \ condition2) is logically equivalent to the expression (! Condition1 && ! condition2). Use De Morgan’s laws to write equivalent expressions for each of the following, then write an application to show that both the original expression and the new expression in each case produce the same value:
- 1. ! (x < 5) && ! (y >= 7)
- 2. ! (a == b) || ! (g ! = 5)
- 3. ! ((x <= 8) && (y > 4))
- 4. ! ((i >4) || (j <= 6))
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
Java How To Program (Early Objects) (10th Edition)
Additional Engineering Textbook Solutions
Starting Out with Programming Logic and Design (4th Edition)
C How to Program (8th Edition)
C Programming Language
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Starting out with Visual C# (4th Edition)
- Laws of logic: Could you make sure this question is proven correctly using the laws.arrow_forward11. Simplify the following Boolean function F, together with the don’t-care conditions d :arrow_forward4. The Area of the Target: To decide on prizes for the archery contest, you decided to use the areas of the center and rings. You decided that rings with smaller areas should be worth more points. But how much more? Complete the following investigation to help you decide. a. Find the sequence of the areas of the rings, including the center. (Be careful.) b. Write a recursive formula and an explicit formula for this sequence. C. Write the explicit formula in summation notation. Find the total area of the bull's eye if it had 9 rings around the bull's eye.arrow_forward
- Computer Engineering Labarrow_forwardProblem Statement: The mathematician Conway imagined a game, called game of life, whichconsidered cells that are susceptible to reproduce, disappear, or survive when they obey certainrules. These cells are represented by elements on a grid of squares, where a grid has an arbitrarysize. Thus, each cell (except those on the boundaries of the grid) is surrounded by eight squaresthat contain other cells. The rules are stated as follows:1. Survival: Each cell that has two or three adjacent cells survives until the next generation.2. Death: Each cell that has at least four adjacent cells disappears (or dies) by overpopulation.Also, each cell that has at most one adjacent cell dies by isolation.3. Birth: Each empty square (i.e., dead cell) that is adjacent to exactly three cells gives birthto a new cell for the next generation.It is worth noting that all births and deaths occur at the same time during a generation.Write a program that simulates this game and displays all successive…arrow_forwardCan you help me with this question ?arrow_forward
- 3. You are expected to write a recursive function called powy(base, exponent) that, when called, returns baseponent As an example, powy( 6, 5 ) =6*6*6*6*6. Assume that exponent is an integer greater than or equal to 1. Hint: The recursion step would use the relationship baseponent - base baseponent - 1 and the terminating condition occurs when exponent is equal to 1, because base' = basearrow_forward(GREATEST COMMON DIVISOR) The greatest common divisor of integers x and y is the largest integer that evenly divides into both x and y. Write and test a recursive function gcd that returns the greatest common divisor of x and y. The gcd of x and y is defined recursively as follows: If y is equal to 0, then gcd (x, y) is x; otherwise, gcd (x, y) is gcd (y, x % y), where % is the remainder operator.arrow_forward(a) State the two common programming errors that cause a recursive function to call itself endlessly.arrow_forward
- : Given a boolean expression consisting of the symbols 0 (false), 1 (true), & (AND), I (OR), and / (XOR), and a desired boolean result value result, create a function that counts the number of ways the expression may be parenthesized such that it evaluates to result. The expression should be completely parenthesized (for example, (0) A(1)) but not excessively (for example, (((0)) / (1))).EXAMPLE \scountEval("l/01011", false) yields 2 counts."0&0&0&1All0", true) = 10arrow_forward: Simplify the following Boolean expressions to a minimum * :number of literals F = abc + (a + c) + ābcarrow_forward6. Write a recursive function that find the sum of the following series. 1+1/2+1/4+1/8+...+1/2"arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning