Define a logmat class to represent logical matrix

Assignment Help Programming Languages
Reference no: EM131371886

Object-Oriented Programing Assignment

Introduction -

A logical matrix or (0, 1) matrix is a matrix with entries from the Boolean domain B = {0, 1}. Such a matrix can be used to represent a binary relation between a pair of finite sets. If R is a binary relation between the finite indexed sets X and Y (so R ⊆ X × Y), then R can be represented by the logical matrix M whose row and column indices index the elements of X and Y, respectively, such that the entries of M are defined by:

           1  (xi, yj) ∈ R

M i,j =

            0  (xi, yj) ∉ R

In order to designate the row and column numbers of the matrix, the sets X and Y are indexed with positive integers: i ranges from 1 to the cardinality (size) of X and j ranges from 1 to the cardinality of Y.

Example:

The binary relation R on the set {1, 2, 3, 4} is defined so that aRb holds if and only if a divides b evenly, with no remainder. For example, 2R4 holds because 2 divides 4 without leaving a remainder, but 3R4 does not hold because when 3 divides 4 there is a remainder of 1. The following set is the set of pairs for which the relation R holds.

{(0,0), (1,0), (2,0), (3,0), (4,0), (1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 4), (3, 3), (4, 4)}.

The corresponding representation as a Boolean matrix is:

1092_Figure.png

Define a class (called LogMat) to represent logical matrix of any binary relation as explained previously.

A. The class has three member variables: matrix(as dynamic 2-D array), rowSize and columnSize.

B. Provide a default constructor with default parameter to initialize an empty matrix to 0 with a maximum of 10 X 10.

C. Overload the stream extraction (>>) to read the R from input file where the format of the input file as

{(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 4), (3, 3), (4, 4)} for each R.

D. Overload the stream insertion (<<) to display the matrix on the screen.

E. Overload the (==) operator to check if two sets are equal.

F. Overload the plus (+) operator to return the combination between two sets. For example if A and B are sets then A + B should return a set that contains all the elements in either or both of the sets.

G. Provide functions that should/must be in the class.

H. Write main program that:

i. Create an input file for each of the below relations:

- aRb holds if and only if a divides b evenly, with no remainder

- aRb holds if and only if the sum of a+b is an even number.

ii. Each set should be in format as mentioned in part C.

iii. Create at least one object for each relation.

iv. Test the operators the overloaded operators.

Reference no: EM131371886

Questions Cloud

Develop a profile of the individual that can be submitted : Develop a profile of this individual that can be submitted to a company's newsletter. Identify the individual, their position within the company, and briefly describe the organization.
How many papers should be printed daily : How many papers should be printed daily if the average demand is 34,750 papers and the standard deviation of demand is 3,560?
Write a response about the given post : Review this entire website and study the glacial history of the area. We, of course have no written proof of this - while there MAY have been humans watching it, they were not taking notes or pictures that they left for us to find. SO - what pro..
Summarize both ideas in memo format to present to your boss : Bus 325- Summarize both ideas in memo format to present to your boss. Create compelling arguments in favor of your solution to persuade your boss.
Define a logmat class to represent logical matrix : COMP3200: Object-Oriented Programing Assignment. Define a class (called LogMat) to represent logical matrix of any binary relation as explained previously. The class has three member variables: matrix(as dynamic 2-D array), rowSize and columnSize
Describe the basic makeup of a ladder logic rung : When is the ladder rung considered as having logic continuity?
What should the limit be : If a country wants to set the mileage limit at a point such that 80% of the tourists in the program will want to drive fewer kilometers, what should the limit be?
What does the address assigned to an instruction indicate : When are input branch instructions used as part of a ladder logic program?
Find mean and the standard deviation of the number of people : The agency found that 10% of the time, over 1,000 people respond immediately after a mailing, and 50% of the time, at least 650 people respond right after the mailing. Find the mean and the standard deviation of the number of people who respond fo..

Reviews

len1371886

1/25/2017 7:22:31 AM

Your C++ code as soft copy via Moodle: classes definitions and implementations, and main program. Make sure your ID number appear as a first line comment in all your files. Your file name also should contain your ID number. Submit hard copy of your assignment with cover page which is grading sheet. This sheet is available with this assignment section in the Moodle. Write your name and id on it. Students involved in copying will be severely penalized. A zero mark will be assigned the first time a student is caught involved in copying and his/her name will be added to a watch list maintained by the Head of Department. Further repeated involvement in copying will cause the student to get an F grade in that course. This is in line with the university academic regulations.

Write a Review

Programming Languages Questions & Answers

  Write a program that draws a picture of a house

Write a program that draws a picture of a house. It could be as simple as the accompanying figure, or if you like, make it more elaborate (3-D, skyscraper, marble columns in the entryway, whatever).

  Write a program to prints the sum of all elements with an

write a program to prints the sum of all elements with an even index and all elements with an odd index of the

  Explain the costs involved in the creation of the system

Explain the costs involved in the creation of the system. Describe the ongoing maintenance that will be required. Provide a workflow diagram in Visio or equivalent software to illustrate how the system will work.

  Create process that will create pattern in which is pyramid

Create a process that will create a pattern in which is a pyramid. The user should enter the maximum number of rows to be output, then 1 should be output in the first row, 1 2 3 output in the second row, 1 2 3 4 5 should be output in the 3 row, e..

  Implement to do a matrix-matrix product

Implement and check the time to do a matrix-matrix product of a 1000x500 matrix with a 500x800 matrix of floats sequentially and using 1,2,3,4, and 8 threads on dual and quad core processors.

  What default link state and visited link state

what default link state and visited link state are,on a CSS style sheet. And how to put them on the stlye sheet.

  Write a program stars that uses two nested for loops

Write a program Stars that uses two nested for loops to output the pattern of stars shown below (note that there are no spaces in between stars).

  Writes a function that takes a list of integers

Using ML writes a function that takes a list of integers as argument and returns a pair consisting of the sum of the even position and the sum of the odd positions of the list. You should not use auxiliary functions

  Create class named fraction which represent new data type

Math 3300 Programming Assignment. Create a class named fraction which will represent a new data type corresponding to fractions. Your class should create the following private members: Integers n and d corresponding to the numerator and denominator..

  Explaining tags used for effective page layout

Page layout is one of the most time consuming tasks for a web designer. What are some of the tags used for effective page layout and how do they work?

  What are the benefits of the two when developing a compiler

What is the difference between top-down and bottom-up parsing

  Functions of standard and statistical calculators

Write a windows application in Visual Basic to perform functions of standard and statistical calculators.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd