Write the code as described in the questions below. Submit your code electronically in the box at the bottom. You may only use Java, C# or C++. The economy is defined using a 2-dimensional data structure: A “payday” will be considered to be any region of $ values where all cells in the region are connected either vertically or horizontally. For example, the following illustrates a matrix with 5 rows and 8 columns containing three objects. $’s and P are used in the diagram to represent the two types of values: PPPP$PPPPPP$$PPPPP$$PPP$PP$PPPP$
Pls make a code for this on c++ and make sure it is 100% correct. i wastred 4 questoins on this and they all are not correct.
Write the code as described in the questions below. Submit your code electronically in the box at the bottom. You may only use Java, C# or C++.
The economy is defined using a 2-dimensional data structure:
A “payday” will be considered to be any region of $ values where all cells in the region are connected either vertically or horizontally. For example, the following illustrates a matrix with 5 rows and 8 columns containing three objects. $’s and P are used in the diagram to represent the two types of values:
PPPP$PPPPPP$$PPPPP$$PPP$PP$PPPP$P$PPP$$$
a) Write a program to read in the data from the text file and store it into a data structure. Your program should output it to the screen after it has read in the file. (If you can’t get this to work hard-code the above example and continue to part b). Here is a sample text file (containing the above data): Payday.txt.
b) Write a function CountTotalMoney() which will return an integer describing the number of “$”s in the economy matrix
b) Write a function CountMoneyPotSize (dataStructure M, int startRow, int startCol) with the following post condition:
/* Post: The number of cells in the payday (if any) which has
a cell at location startRow, startCol returned */
For example, a call to CountMoneyPotSize(M, 0, 4); --where M is the matrix (whatever data structure you used), and 0, 4 is the startRow and startCol-- would return 6 because there are 6 cells making up the payday which has a cell at 0, 4.
Note that the “$” value at location (4, 1) is not counted since it only touched the payday via a diagonal.

Step by step
Solved in 5 steps with 4 images









