Starting from:

$30

Assignment No. 4 EECS 210 Discrete Structures

Assignment No. 4
EECS 210
Discrete Structures

Submit deliverables in a single zip file to Canvas
Name of the zip file: FirstnameLastname_Assignment4 (with your first and last name)
Name of the Assignment folder within the zip file: FirstnameLastname_Assignment4
Deliverables:
1. Copy of Rubric4.docx with your name and ID filled out (do not submit a PDF).
2. Source code.
3. Screen print showing the successful execution of your code or copy and paste the
output from a console screen to a Word document and PDF it.
Assignment:
• You may use any language you want, but if you want help from me or one of the
SIs, you should probably use C++ or Python.
• Use the methods or functions inherent in the language and/or using methods or
functions you create. Like previous assignments, don’t “hard code” a solution you
did on paper as the output.
• Create a program for the following:
1. Write code that determines if a relation (R) of ordered pairs is reflexive or not
& then if it is not, finds the reflexive closure of R (R*). The output should be:
a) R = {…}
b) R is or is not reflexive
c) R* if it is not reflexive
d) Show the code works for the relation {(1,1), (4,4), (2,2), (3,3)} on the
set {1,2,3,4}.
e) Show the code works for the relation {(a,a), (c,c)} on the set {a,b,c,d}.
2. Write code that determines if a relation (R) of ordered pairs is symmetric or
not & then if it is not, finds the symmetric closure of R (R*). The output
should be:
a) R = {…}
b) R is or is not symmetric
c) R* if it is not symmetric
d) Show the code works for the relation {(1,2), (4,4), (2,1), (3,3)} on the
set {1,2,3,4}.
e) Show the code works for the relation {(1,2), (3,3)} on the set
{1,2,3,4}.
3. Write code that determines if a relation (R) of ordered pairs is transitive or not
& then if it is not, finds the transitive closure of R (R*) using Warshall’s
Algorithm. The output should be:
a) R = {…}
b) R is or is not transitive
c) R* if it is not transitive
d) Show the code works for the relation {(a,b), (d,d), (b,c), (a,c)} on the
set {a,b,c,d}.
e) Show the code works for the relation {(1,1),(1,3),(2,2),(3,1),(3,2)} on
the set {1,2,3}.
4. Write code that determines if a relation (R) of ordered pairs is an equivalence
relation or not and the reason why. The output should be:
a) R = {…}
b) R is or is not an equivalence relation
c) The reasons why, if it is not an equivalence relation (i.e., it is not
reflexive, and/or it is not symmetric, and/or it is not transitive).
d) Show the code works for the relation {(1,1),(2,2),(2,3)} on the set
{1,2,3}.
e) Show the code works for the relation {(a,a),(b,b),(c,c),(b,c),(c,b)} on
the set {a,b,c}.
5. Write code that determines if a relation (R) of ordered pairs is a poset of the
set (S) or not and the reason why. The output should be:
a) S = {…}
b) R = {…}
c) (S,R) is or is not a poset
d) The reason why, if it is not poset (i.e., it is not reflexive, and/or it is
not antisymmetric, and/or it is not transitive.
e) Show the code works for the relation {(1,1), (1,2), (2,2), (3,3), (4,1),
(4,2), (4,4)} on the set {1, 2, 3, 4}.
f) Show the code works for the relation {(0, 0), (0, 1), (0, 2), (0, 3), (1,
0), (1, 1), (1, 2), (1, 3), (2, 0), (2, 2), (3, 3)} on the set {0, 1, 2, 3}.
• Provide comments that explain what each line of code is doing. See rubric below.
Rubric for Program Comments
Exceeds Expectations
(90-100%)
Meets Expectations
(80-89%)
Unsatisfactory
(0-79%)
Software is adequately
commented with prologue
comments, comments
summarizing major blocks of
code, and comments on every
line.
Prologue comments are present
but missing some items or some
major blocks of code are not
commented or there are
inadequate comments on each
line.
Prologue comments are missing
all together or there are no
comments on major blocks of
code or there are very few
comments on each line.
Adequate Prologue Comments:
• Name of program contained in the file (e.g., EECS 210 Assignment 3)
• Brief description of the program, e.g.:
o Python code for demonstrating operations on relations and properties of
relations.
• Inputs (e.g., none, for a function, it would be the parameters passed to it)
• Output, e.g.,
o Print out of the name of each exercise, followed by the exercise’s output.
• Author’s full name
• Creation date: The date you first create the file, i.e., the date you write this
comment
Adequate comments summarizing major blocks of code and comments on every line:
• Provide comments that explain what each line of code is doing.
• You may comment each line of code (e.g., using //) and/or provide a multi-line
comment (e.g., using /* and */) that explains what a group of lines does.
• Multi-line comments should be detailed enough that it is clear what each line of
code is doing.
Remember:
• Your Programming Assignments are individual-effort.
• You can brainstorm with other students and help them work through problems in
their programs, but everyone should have their own unique assignment programs.

More products