Define a class to represent logical matrix

Assignment Help C/C++ Programming
Reference no: EM131295735

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:

1

0

0

0

0

 1

1

1

1

1

0

1

0

1

 1

0

0

1

0

1

0

0

0

1

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.

To be submitted:

- 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.
Code of ethics:

- Late submission of assignments faces a penalty of 20% reduction per day

- 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 (see pages 36-37 of the 2005 edition of the university academic regulations booklet).

Reference no: EM131295735

Questions Cloud

Company uses two departments to make its products : Jocey Manufacturing Company uses two departments to make its products. Department I is a cutting department that is machine intensive and uses very few employees. Machines cut and form parts and then place the finished parts on a conveyor belt that c..
Analyze what would be the various consequences of the tax : "Consumer surplus" represents the difference between what a consumer is willing to pay for a good or service and the price that they actually pay. What would be the various consequences of this tax on both consumption as well as production?
Systematic review or literature review that clearly describe : systematic review or literature review that clearly describes and assesses the problem, its magnitude, causes and determinants, and discusses prevention and intervention strategies
Possible sources of upward bias in the rate : Suppose you calculate a grocery price inflation rate. Using the arguments presented in the chapter, explain possible sources of upward bias in the rate you calculate, relative to the actual trend of food prices.
Define a class to represent logical matrix : COMP3200: Object-Oriented Programing - Define a class (called LogMat) to represent logical matrix of any binary relation as explained previously.
Strategic plan-implementation plan : Strategic Plan: Implementation Plan, Strategic Controls, and Contingency Plan Analysis Create a 1,400-word minimum strategic implementation plan. Include the following:
The separate performance obligations in the contract : Creative Computing sells a tablet computer called the Protab. The $620 sales price of a Protab Package includes the following: Indicated below whether each item is a separate performance obligation and allocate the transaction price of 120,000 Protab..
How does the interview contribute to the assessment process : Why is a clinical interview necessary as an initial component to the assessment process? How does the interview contribute to the assessment process?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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