Fun Array Project
In this project, you will perform various operations on an array of ints and and an array of doubles (Source code for the project)
- Task #1) Make the constructors work correctly by initializing both arrays
- Task #2) Make the methods function as described in the source code for the project
- Grading Rubric
String Array Project
the StringArr class as follows
Projects :
SeatingChart
This classs should have the following:
instance variables: String[][] theChart , int numRows, int numCols .
a default constructor that initializes the instance variables.
the array should be initialized to have empty Strings
A constructor that initializes
MazeGenerator: Create a MazeGenerator Class that creates Maze objects
the Maze class should be implemented using a two dimensional array and should use an X to symbolize a wall and a minus sign to symbolize a clear passage. Below is an example of what a maze object would like, graphically. Every maze should have a starting and ending point (feel free to implement starting and ending points any way that you want-- I used a red S and a red F to symbolize start and finish)
- The Constructors
- Default Construct should initialize the
sArrinstance variable to
- Write a constructor with a single parameter, an array of strings, and initialize
sArrto the parameter
- Default Construct should initialize the
- Methods
- Implement all methods described in the source code
theChart to the parameter- Mutator methods:
- public void clearAllSeats(); //this should set all elements in the double array to empty strings
public void setSeat(int row ,int col, String to);//Sets the value of the seat at row r, column col toString to.-
public void swap(int row1,int col1, int row2, int col2);;//Swaps String at row1,col1 with String at row2,col2
- Accessor methods:
public boolean contains(String str);//returns true if str is in the arraypublic int[] getCell(String str);//returns a two element arrow indicating the row and column ofstr. If str is not in array return an empty array.public boolean swap(String s1,String s2);;//Swaps s1 with s2. Use row major form to find the first occurance of each STring. Returns false if either element is nonexistant in theChart.public int getRow(String str);//returns the row number of str; returns -1 if Str is not in arraypublic int getCol(String str)//returns the column number of str; returns -1 if Str is not in arraypublic String get(int row ,int col);//returns the String atrow, col.
| S | - | x | - | - |
| - | x | - | x | x |
| - | x | - | x | - |
| - | x | - | x | - |
| - | - | - | - | F |