question archive For this question, you will be using an improved version of the template Vector class from question 1

For this question, you will be using an improved version of the template Vector class from question 1

Subject:Computer SciencePrice: Bought3

For this question, you will be using an improved version of the template Vector class from question 1. This improved version is compliant with all the relevant SOLID principles.

a.    Create minimal but complete class called Logical. Logical uses your improved template Vector class from question 1 to create 2D array of unsigned integers. The 2D array is internal to Logical.

 

Three behaviours are needed in Logical: and, or and not. The method and implements the and behaviour that does a logical "and" operation with the corresponding elements of an equally sized 2D array. The other two behaviours are implemented by correspondingly named methods and perform the corresponding logical operations.

 

When performing the operations, any non-zero number is considered to be "true"; the number zero is considered to be false.

 

The operations return an enumerated value of success if the two arrays are of identical size and a value of fail if the size are not identical.

 

Two other methods are used to initialise Logical objects. The method setTrue sets all values to 1. The method setFalse sets all values to 0;

 

Assuming there are two objects of Logical, (a, b), the following are just some conceptual examples of what the intention is:

a.setTrue() means a is set to true

a.and(b)      a is changed if necessary

a.or(b)         a is changed if necessary

b.not(b)       b is changed if necessary

 

Be mindful of the design of the Logical class, methods, including any constructors. Do not provide any method that is not necessary. Methods essential for Logical must be provided. There is a penalty of 5 marks per incorrect method.

 

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE