De Morgan’s Laws. We have 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 Law to write equivalent expressions for each of the following, and then write a program to show that both the original expression and the new expression in each case are equivalent:
a. !(x<5) && !(y>=7)
b. !(a==b) || !(g!=5)
c. !(x<=8) && (y>4)
d. !((i>4) || (j<=6))
Name your program as DeMorgansLaw.java
student_2012
0
Newbie Poster
Recommended Answers
Jump to PostDaniWeb Member Rules include:
"Do provide evidence of having done some work yourself if posting questions from school or work assignments"
http://www.daniweb.com/community/rules
Jump to PostThat looks reasonable - so what happens when you execute it - do you get the correect results or what? What help do you need exactly?
All 7 Replies
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
student_2012
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
student_2012
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
student_2012
0
Newbie Poster
NormR1
563
Posting Sage
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.