Student needs help

Status
Not open for further replies.

kett_jess

Beta member
Messages
1
I need help write a program using Visual C# 2008 the requirements are listed below:

Two Dimensional Array Class:

Create a two-dimensional array class of characters called Array2d . Your Array2d should have functions that do the following:

initialize the contents of the array by setting all values to '.' (constructor)
return the value of any individual cell (char getValue(int, int); the parameters are the cell coordinates)
input a value into an individual cell ( void setValue(int, int, char); the parameters are the cell coordinates and the value to be input into the cell)
output the contents of each cell in the array in order (void display();)
copies one 2-d array to another (void copy(Array2d);)
reset all the values of the array to '.' (void reset();).
Main Program:

Implement a simple program to demonstrate how your class works and do the following:

Declare two two-dimentional arrays
Create a menu that allows the user to do any of the following (you must use a case (switch) statement for this:
output the contents of the arrays - let the user decide which one
read in cell coordinates from the file that I will give you
read in cell coordinates from the keyboard
enter x and y cell coordinates and return the value in the cell.
enter x and y cell coordinates and enter a value to put in the cell
copy one array to the other


Other Specifications:

Create a Directory call ArrayADT to hold your files for this assignment
The class should be in a separate file called Array2d.cs.
The main program should be in a file called main.cs .
Dimensions such as the size of the array should be declared as constants
Put your name and a short description of the project or class at the top of each file.
Zip the whole project and turn in the zip file.
You may write a console application or a windows application



Can somebody please help?
 
Well, I know Java, not C# but in Java here is how you would copy the 2d arrays:

Code:
for (int i = 0; i < array1.length; i++){
   for(int j = 0; j < array1[i].length; i++){
        array2[i][j] = array1[i][j];//copies array value at location i,j to new array.
   }
}

You will need to use a similar process for printing out the array and resetting the array. Just a bunch of loops with a different main action.
 
This looks like homework. If you have specific questions, post your code and we can help where applicable. However, you need to attempt to solve these problems yourself.
 
This looks like homework. If you have specific questions, post your code and we can help where applicable. However, you need to attempt to solve these problems yourself.

Agreed. That's why I figured my code in Java would be enough to help him get the idea without giving away most of the methods :p
 
here's an idea, post up whatever you've got so far, and I'll point out any bits I see are wrong along with some info on the basic principles you'll need to fix those bits.
THEN, with your new understanding, you'll be able to finish this program, AND you'll be able to pass when exam time rolls around because you'll have written the program yourself, and subsequently definitely know your stuff.
 
Status
Not open for further replies.
Back
Top Bottom