PLEASE help! There should be three files a (.h file), a (main.cpp file), and a (test.cpp file) please do not miss any of the questions!! I'm going to try this myself too
thanks for any and all help
Write a class called array2x2 which includes the following members: Private members: o A two dimensional array to store the data: double data[2][2];
Public members: o A default constructor which initializes data to having entries all 0. [i.e., data[i][j]=0.0 for all i and j: data=0 0 0 0]
o A function that displays the data in the following format: If data=23 −4 6 7, then display {{23, -4}; {6,7}}
o A function that given a 2x2 array A, sets the entries of data to that of A.
o A function that given a double x and indexes i and j, sets the element i,j of data to x ( data[i][j]=x). Make sure that i, j are within index bounds. [E.g. setElement(1,1, -10) will result in , data=0 0 0 −10. setElement(1,2,45) will do nothing.]
o A function that given the indexes i and j returns the value data[i] [j]. If the indexes are out of bounds, reduce/increase them to the closest legal index bound. [for example, if i=-2 and j=2 convert them to i=0 and j=1 and return data[0][1].]
o A function that returns the maximum value of the data.
o A function that searches for a value in data. If value is found, return 1 (true) and the indexes of the position found. If it is not found, return 0 (false) and -1, -1 for the indexes. (Hint: pass indexes as reference parameters)
Write a class called matrix2x2 derived from array2x2 via public inheritance. In addition, this news class should have the following member functions:
Public members: o A constructor with one default parameter set to 0. If the value of the parameter is b, then data should be initialized to: data= 0 0 [i.e., data[0][0]=b, data[1][1]=b, the other entries 0].
o A function display (overwriting the display function of array2x2), that displays the data as
o A function that returns the determinant.
, then the determinant is defined as the number (a*b-
[ If data=
c*d).]
o A function that multiplies the matrix by a number x.
, then the function returns a matrix2x2 with data= ∗
[If data=
∗ ∗ ∗ .]
o A function that sums two matrices. I.e. matrix2x2 sumMatrix(matrix2x2 M) [If data= and M.data=
+ℎ.]
+ + +
In the main function (outside the class), create a function that subtracts two matrices. Hint: use the last two public functions implemented inside the class For all the above write a main program that tests all the functions. When a function makes changes to the array/matrix, display before and after effects by printing the array/matrix using display function implemented.

![Test.cpp: #include array2x2. h array2x2: :array2x2(void) for (int i0;i<2;i++) for (int j 0;]<2 ; j ++) = data[1] [j] 0; = /](http://img.homeworklib.com/questions/e5f3db80-52f1-11eb-8d30-93fd4bc889c6.png?x-oss-process=image/resize,w_560)
![// Set element individually void array2x2:13etDataElement (int a, int b, double i) data[a] [b] 1; = // Get the data value ind](http://img.homeworklib.com/questions/e66ec770-52f1-11eb-8274-e9d993ee49f0.png?x-oss-process=image/resize,w_560)

![array2XZ.n: #include <iostream> using namespace std; class array2X2 rivate: double data[2] [2]; ublic: // Constructor array2x](http://img.homeworklib.com/questions/e77a2ac0-52f1-11eb-932b-e7ab25e8dfbb.png?x-oss-process=image/resize,w_560)
![matrix.h: #include <iostream> #include array2 x2.h class matrix2x2: public array2x2 ublic: double matArray [2] [2] matrix2x](http://img.homeworklib.com/questions/e7f2fc10-52f1-11eb-aa06-af451a2a5287.png?x-oss-process=image/resize,w_560)

copyable code:
main.cpp:
#include <iostream>
#include "matrix.h"
using namespace std;
int main(void)
{
matrix2x2 matrix(35.0);
cout << endl << " Initial Matrix: " << endl;
matrix.display();
cout << endl << " Determinant: " << matrix.datadeterminent() << endl;
matrix.display();
cout << endl << " After Multiplication: " << endl;
matrix.muliplicatMatrix(3);
matrix.display();
cout << endl << " After Summation: " << endl;
matrix2x2 mat2(20.9);
matrix.sumofMatrix(mat2);
matrix.display();
system("pause");
return 0;
}
Test.cpp:
#include"array2x2.h"
array2x2::array2x2(void)
{
for (int i = 0;i<2;i++)
{
for (int j = 0;j<2;j++)
{
data[i][j] = 0;
}
}
}
//Display Method
void array2x2::display()
{
cout << endl << "{{" << data[0][0] << "," << data[0][1] << "};{" << data[1][0] << "," << data[1][1] << "}}" << endl;
}
// Set Values
void array2x2::setDataEntries(double arr[2][2])
{
for (int i = 0;i<2;i++)
{
for (int j = 0;j<2;j++)
{
data[i][j] = arr[i][j];
}
}
}
// Set element individually
void array2x2::setDataElement(int a, int b, double i)
{
if (a<2 && b<2)
{
data[a][b] = i;
}
}
// Get the data value individually
double array2x2::getDataElement(int a, int b)
{
double value;
if (((a<2) && (a >= 0)) && ((b<2) && (b >= 0)))
{
value = data[a][b];
}
else
value = -1;
return value;
}
// Get the max value
double array2x2::getmaximum()
{
double greater = data[0][0];
for (int i = 0;i<2;i++)
{
for (int j = 0;j<2;j++)
{
if (data[i][j]>greater)
{
greater = data[i][j];
}
}
}
return greater;
}
// Search for a value
int array2x2::searchDataElement(double value)
{
int found = 0;
for (int i = 0;i<2;i++)
{
for (int j = 0;j<2;j++)
{
if (data[i][j] == value)
{
found = 1;
cout << "The index is: " << i << ", " << j << endl;
break;
}
}
}
if (found == 0)
{
cout << "The index is: -1, -1" << endl;
}
return found;
}
array2x2.h:
#include <iostream>
using namespace std;
class array2x2
{
private:
double data[2][2];
public:
// Constructor
array2x2(void);
//Display Method
void display();
// Set Values
void setDataEntries(double array[2][2]);
// Set element individually
void setDataElement(int a, int b, double i);
// Get the data value individually
double getDataElement(int a, int b);
// Get the max value
double getmaximum();
// Search for a value
int searchDataElement(double value);
};
matrix.h:
#include<iostream>
#include "array2x2.h"
class matrix2x2 : public array2x2
{
public:
double matArray[2][2];
matrix2x2(double b = 0)
{
array2x2::setDataElement(0, 0, b);
array2x2::setDataElement (1, 1, b);
}
void display()
{
array2x2::display();
}
double datadeterminent()
{
/* Determinant of a matrix is ad - bc */
double deter = (array2x2::getDataElement(0, 0) * array2x2::getDataElement(1, 1)) - (array2x2::getDataElement(0, 1) * array2x2::getDataElement(1, 0));
return deter;
}
void muliplicatMatrix(int x)
{
for (int i = 0;i<2;i++)
{
for (int j = 0;j<2;j++)
{
double dval = array2x2::getDataElement(i, j);
/* Missing comma after j */
array2x2::setDataElement(i, j, dval*x);
}
}
}
void sumofMatrix(matrix2x2 M)
{
for (int i = 0;i<2;i++)
{
for (int j = 0;j<2;j++)
{
double dval = array2x2::getDataElement(i, j);
array2x2::setDataElement(i, j, (dval + M.getDataElement(i, j)));
}
}
}
};
PLEASE help! There should be three files a (.h file), a (main.cpp file), and a (test.cpp...
Language is C++ Basic principles and theory of structured programming in C++ by implementing the class: Matrix Use these principles and theory to help build and manipulate instances of the class (objects), call member functions Matrix class implementation from the main function file and, in addition, the Matrix class must have its interface(Matrix.h) in a separate file from its implementation (Matrix.cpp). The code in the following files: matrix.h matrix.cpp matrixDriver.h Please use these file names exactly. Summary Create three files...
You are to write three functions for this lab: mean, remove, display. Download the main.cpp file provided to get started. Read the comments in the main function to determine exactly what the main function should do. //include any standard libraries needed // - Passes in an array along with the size of the array. // - Returns the mean of all values stored in the array. double mean(const double array[], int arraySize); // - Passes in an array, the size...
So on this assignment... I have the main.cpp file, the fan.cpp
file, and the fan.h file created and open in Dev C++. However,
every time I try to compile I get a series of undefined reference
to errors. Any advice is much appreciated!!!
(45 pts) Work Programming Exercise 9.2 (class Fan) in the textbook on page 367. Additional specifications: • Use separate header and implementation files. • The main program (not the functions) should display the values of Speed, On,...
Use two files for this lab: your C program file, and a separate text file containing the integer data values to process. Use a while loop to read one data value each time until all values in the file have been read, and you should design your program so that your while loop can handle a file of any size. You may assume that there are no more than 50 data values in the file. Save each value read from...
It is a C++ program by using
inheritance and vectors
My professor said that all the files should be separate. like
File.cpp, File.h, Text.cpp,Text.h,Main.cpp
I already have these files
File.cpp
#include "File.h"
// Constructor of File that takes File name and type as
arguments
File::File(string type, string name) {
this->type = type;
this->name = name;
}
//returns the type.
string File::getType() {
return type;
}
//returns the name of file.
string File::getName() {
return name;
}
File.h
#ifndef __FILE_H__
#define...
Please submit a .cpp file or upload zip if you have more than one file before the time up. No library function is allowed. ***The code must contain your name and has proper format. Create a class named CupCake. It contains: • Has private instance variables 1. egg 2. butter 3. baking powder 4. sugar 5. flour 6. milk • All members must have public methods: getter() and setter(). • A constructor - a default constructor with no arguments. The...
C++ Assignment - Only Implementation file( VectorDouble.cpp file) required. The header file is already given. Please help, thumbs up guaranteed. Chapter 8 discussed vectors, which are like arrays that can grow in size. Suppose that vectors were not defined in C++. Define a class called VectorDoublethat is like a class for a vector with base type double. Your class VectorDoublewill have a private member variable for a dynamic array of doubles. It will also have two member variables of type...
1. Your project will include the following three files: A header file: dynamicArray.h that includes a list of function prototypes as enumerated in the next section. An implementation file: dynamicArray.cpp that implements the functions declared in the header file. A test driver file: dynamicArray-main.cpp that includes the main() function so that you can test all the functions you've implemented above. 2. The header file dynamicArray.h will include the following list of functions: constructing a dynamic array of the specified size...
Assignment is designed to develop your ability to create static methods and manipulate 1D and 2D arrays in Java. Create a single Java class Matrix and inside the class create the specified static methods as described Task # Description 1 Create a matrix (known components) 2 Create a matrix (random components) 3 Create a matrix from vectors 4 Compare two matrices 5 Add two matrices 6 Subtract two matrices 7 Multiply a matrix by a scalar 8 Multiply two matrices...
Copy the following java codes and compile //// HighArray.java //// HighArrayApp.java Study carefully the design and implementation HighArray class and note the attributes and its methods. Create findAll method which uses linear search algorithm to return all number of occurrences of specified element. /** * find an element from array and returns all number of occurrences of the specified element, returns 0 if the element does not exit. * * @param foundElement Element to be found */ int findAll(int...