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

  Create a flowchart in powerpoint

I created the program as best I could using what I have learned so far, but it won't run. I also am confused as to how to create a flow chart in some other program to accompany it. Here are my problems:

  Create program to read file calculate numbers of single men

Create a program to read through file and calculate numbers of married men, single men, married women and single women.

  Write a program that prompts for and reads an amount

Write a program that prompts for and reads an amount (integer) for Canadian dollars and convert the amount to Euros. The exchange rate is 1.

  Introduction to programming logic

JoCo imports products from overseas vendors and sells them in a series of online retail stores. In the recent past, JoCo has experienced a significant amount of growth in their online marketplace.

  Compute tax percentage using nested if

On Home Sales Data worksheet, in column E, compute Tax Percentage. Using nested IF calculate the following (Hint: do not use the function AND because if the house does not have 1 bedroom

  Program that reads a word and writes the reverse of the word

Show every stack operation and the state of both the numbers and operations stacks after every push and pop when evaluating the arithmetic expression: (((10 * 9) - 3) * (((8 * 2) + 16))).

  Assignment program on crawler game

Update the Crawler game attached to allow a user to traverse the Cave. They should be prompted in each room to pick an exit or quit

  Write a script that inputs a numeric check amount

Write a script that inputs a dollar amount to be printed on a check, then prints the amount in check protected format with leading asterisks if necessary. Assume that nine spaces are available for printing the amount.

  Identify the errors in the program segment

Determine the output displayed when the button is clicked. Assume the five lines of the file Dates.txt contain the numbers 1492, 1776, 1812, 1929, and 1941 and the file is in the appropriate folder.

  The basics of multi-process application development

To master the basics of multi-process application development. To appreciate the performance and fault-tolerance bene_ts of multi-process applications.

  Parking garage program to permit user to enter type of car

Parking garage program to permit user to enter type of car in addition to number of hours in parking garage. Program can be use for any number of customers.

  Write function which takes string as its input

In this, you are required to write the function which takes string as its input, chops sentence into words, and for each word, capitalizes the rst letter

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