Define a class to represent logical matrix

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

Object-Oriented Programming 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:

2090_Figure.png

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.

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: EM131305107

Questions Cloud

Write a program that simulates multiple games of blackjack : Blackjack (twenty-one) is a casino game played with cards. The goal of the game is to draw cards that total as close to 21 points as possible without going over. All face cards count as 10 points, aces count as 1 or 11, and all other cards count t..
Call option on the stock that has a strike price : The current price of a stock is $22. In 1 year, the price will be either $28 or $15. The annual risk-free rate is 6%. Find the price of a call option on the stock that has a strike price is of $25 and that expires in 1 year.
Determines if the value is prime : Write a program that gets a starting value from the user and then prints the Syracuse sequence for that starting value.
Black-scholes option pricing model-what is options value : Black-Scholes Model Assume that you have been given the following information on Purcell Industries: Current stock price = $15 Strike price of option = $14 Time to maturity of option = 6 months Risk-free rate = 8% Variance of stock return = 0.11 d1 =..
Define a class to represent logical matrix : COMP3200: Object-Oriented Programming 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
Find the price of a call option on the stock : The current price of a stock is $15. In 6 months, the price will be either $18 or $11. The annual risk-free rate is 7%. Find the price of a call option on the stock that has a strike price of $12 and that expires in 6 months.
What is the exercise value of call option-option time value : A call option on the stock of Bedrock Boulders has a market price of $7. The stock sells for $29 a share, and the option has a strike price of $26 a share. What is the exercise value of the call option? What is the option's time value?
Find a basis for the orthogonal complement : find a basis for the orthogonal complement to the row space; choose a convenient vector in both of these spaces and verify/demonstrate the orthogonality.
Discuss two different roles that project managers can play : Discuss at least two different roles that project managers can play in organizational leadership. Describe at least three human resource factors that affect project management.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Functions to compute the stress and strain in a steel rod

A function to output the stress and strain at different loads of P.

  Using a for loop, print the contents of the array.

Write the code to update every other element within the array with a lowercase x.

  Evaluate the correctness and performance of your allocator

Repeatedly invoke the Ackermann function with increasingly larger values for n and m (be careful to keep n

  Write a function template square()

Write a function template Square() that returns the square of its only argument.

  Odd clusters using c programming

The objective of this project is to write an interactive Odd Clusters game, using the programming knowledge you have gained this semester. Your task is to write a programthat allows one player to play a game of Odd Clusters against the computer o..

  Calculating a discount that customers receive based on order

If the total amount is $100.00 or more, a premium customer receives a 20% discount and a regular customer receives a 15% discount.

  Consider the following nested loop construct

Consider the following nested loop construct. Categorize its efficiency in terms of the variable n using big-O notation. Suppose the statements represented by the ellipsis require four main memory accesses (each requiring one microsecond) and two dis..

  Program that opens a file representing an encoded maze

Write a C++ program that opens a file representing an encoded maze and reads it in properly so it can be analyzed.

  Write appropriate mutator functions that store values

A default constructor that assigns empty strings ("") to the name, department, and position member variables, and 0 to the idNumber member variable.

  Prints the row sums and the column sums

Write a program that reads a 5 x 5 array of integers and then prints the row sums and the column sums

  Inserts a node with info value x

Complete the code for a function that inserts a node with info      value x before, and a node with info value zafter,each node with      info value y in a linked list with first node pointer p.

  Write a main function that reads pairs of positive integers

Prepare a function that has two positive integer parameters (say high and low) that returns the number of powers of two between (but not equal to) those parameters.

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