Question

Create a #define called MAPSIZE. Set to 10. Create global variables DirectionsFilename and MapFilename. Use char...

Create a #define called MAPSIZE. Set to 10.

Create global variables DirectionsFilename and MapFilename. Use char arrays and set them to nulls by using {}.
Create a structure called RowCol that has two int members called row and col to hold the row and column.
Function MoveNorth should have a return value of void and a parameter of a pointer to RowCol.

{

To move north, you need to subtract 1 from PositionPtr->row. Before doing so, you need to check if subtracting one makes you move outside of the map – if subtracting 1 makes PositionPtr->row < 0, then you have moved outside of the map; therefore, the move is not valid and should be skipped.

}

Function MoveSouth should have a return value of void and a parameter of a pointer to RowCol.

{

To move south, you need to add 1 to PositionPtr->row. Before doing so, you need to check if adding one makes you move outside of the map – if adding 1 makes PositionPtr->row > 10, then you have moved outside of the map; therefore, the move is not valid and should be skipped.

}

Function MoveEast should have a return value of void and a parameter of a pointer to RowCol.

{

To move east, you need to add 1 to PositionPtr->col. Before doing so, you need to check if adding one makes you move outside of the map – if adding 1 makes PositionPtr->col > 10, then you have moved outside of the map; therefore, the move is not valid and should be skipped.

}

Function MoveWest should have a return value of void and a parameter of a pointer to RowCol.

{

To move west, you need to subtract 1 from PositionPtr->col. Before doing so, you need to check if subtracting one makes you move outside of the map – if subtracting 1 makes PositionPtr->col < 0, then you have moved outside of the map; therefore, the move is not valid and should be skipped.\

}

Function get_command_line_params should have a return value of void and parameters of argc and argv

{

Create a for loop with argc to go through each value of argv   Look for an argv of DIRECTIONS=    When found, take the string after the = as the value to store in DirectionsFilename.   Look for an argv of MAP=    When found, take the string after the = as the value to store in MapFilename. After looking at all of the strings in argv, if you do not have a value for either DirectionsFilename or MapFilename, then print the message    "DIRECTIONS= and MAP= must be given on the command line"   and exit

}

main()
{
Declare two variables of type FILE * called DirectionFile and TreasureMap
Create a char array called DirectionList
Create a 2D char array called Map. The array should be MAPSIZE for both dimensions (it is square).
Create a char array named buffer of size 2.
Create int variables i, j and k. These will be used later in for loops.
Declare a variable called Position of type struct RowCol.
Declare a pointer to Position called PositionPtr and initialize it to the address of Position.
Call function get_command_line_params
Pass DirectionsFilename to fopen() with a mode of r+ and store the return value in DirectionFile.
Check if DirectionFile is NULL. If it is, call perror() with "DirectionFile did not open" and exit.
Pass MapFilename to fopen() with a mode of r+ and store the return value in TreasureMap.
Check if TreasureMap is NULL. If it is, call perror() with "TreasureMap did not open" and exit.
Use fgets() to read 500 characters from DirectionFile into DirectionList
/* Initialize the map to dashes */
Create a for loop from j = 0 to j < MAPSIZE

{

   Create a for loop from k = 0 to k < MAPSIZE (this is nested inside the j for loop)

{

   Set Map[j][k] to a dash

   }

}


Set Position.row to 0
Set Position.col to 0
Set Map[Position.row][Position.col] to 'S' to signal the starting position
Create a for loop from i = 0 to i < the string length of DirectionList

{  

   if DirectionList[i] is 'N', then call MoveNorth() and pass PositionPtr

   else if DirectionList[i] is 'S', then call MoveSouth() and pass PositionPtr

   else if DirectionList[i] is 'W', then call MoveWest() and pass PositionPtr

   else call MoveEast() and pass PositionPtr


Set Map[Position.row][Position.col] to 'X' to signal a move to this position

}

Set the last Map point (Map[Position.row][Position.col]) to 'E' to signal the ending position
Create a for loop from j = 0 to j < MAPSIZE

{

Create a for loop from k = 0 to k < MAPSIZE (this is nested inside the j for loop)
{

Use "%c " to print Map[j][k].

Use sprintf() to print Map[j][k] to buffer.

Use fputs() to write buffer to TreasureMap (the file TreasureMap will contain NO spaces and NO linefeeds)

}

   Use printf() to print two blanks lines – this will put blank lines between each row

}

Call fclose() with DirectionFile to close it.
Call fclose() with TreasureMap to close it
}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

MAIN.CPP


#include<string>
#include <vector>
#include <iostream>
#include <iomanip>
#include <direct.h>
#include <cstdio>

using namespace std;

//Create a #define called MAPSIZE. Set to 10.
#define MAPSIZE 10

//Create global variables DirectionsFilename and MapFilename. Use char arrays and set them to nulls by using {}.
char DirectionsFilename[100] = { NULL };
char MapFilename[100] ={ NULL };

//Create a structure called RowCol that has two int members called row and col to hold the row and column.
struct RowCol
{
   int Row;
   int Col;
};

//Function MoveNorth should have a return value of void and a parameter of a pointer to RowCol.
void MoveNorth(RowCol *PositionPtr);
void MoveSouth(RowCol *PositionPtr);
void MoveEast(RowCol *PositionPtr);
void MoveWest(RowCol *PositionPtr);

//Function get_command_line_params should have a return value of void and parameters of argc and argv
void get_command_line_params(int argc, std::vector<std::string> argv);

/* additional function to see map as it develops*/
void displaycurrentMoveInMAP(char cdirection, char dMap[MAPSIZE][MAPSIZE]);
char findDirectionFileString[] = "DIRECTIONS=";
char findMAPFileString[] = "MAP=";

int main(int argc, char **argv)
{
   //Declare two variables of type FILE * called DirectionFile and TreasureMap
   FILE *DirectionFile, *TreasureMap;  
  
   //Create a char array called DirectionList
   char *DirectionList = { '\0' };

   //Create a 2D char array called Map. The array should be MAPSIZE for both dimensions (it is square).
   char Map[MAPSIZE][MAPSIZE] = {'\0'} ;
  
   //Create a char array named buffer of size 2.
   char buffer[2] = {'\0'};

   //Create int variables i, j and k. These will be used later in for loops.
   int i,j,k;

   //Declare a variable called Position of type struct RowCol.
   RowCol Position;

   //Declare a pointer to Position called PositionPtr and initialize it to the address of Position.
   RowCol *PositionPtr = &Position;

   //Call function get_command_line_params
   std::vector<std::string> args(argv + 0, argv + argc);
   get_command_line_params(argc,args);

   //Pass DirectionsFilename to fopen() with a mode of r+ and store the return value in DirectionFile.
   DirectionFile = fopen(DirectionsFilename , "r");

   //Check if DirectionFile is NULL. If it is, call perror() with "DirectionFile did not open" and exit.
   if (DirectionFile == NULL)
   {
       perror("DirectionFile did not open" );
       exit(0);
   }


   //Pass MapFilename to fopen() with a mode of r+ and store the return value in TreasureMap.
   TreasureMap = fopen(MapFilename , "w+");
  
   //Check if TreasureMap is NULL. If it is, call perror() with "TreasureMap did not open" and exit.
   if (TreasureMap == NULL)
   {
       perror("TreasureMap did not open" );
       exit(0);
   }


   ////Use fgets() to read 500 characters from DirectionFile into DirectionList
   DirectionList = (char *)malloc(500);
   fgets (DirectionList, 500 , DirectionFile ) ;

   /* Initialize the map to dashes */
   //Create a for loop from j = 0 to j < MAPSIZE
   for (j=0;j<MAPSIZE;j++)
   {
       //Create a for loop from k = 0 to k < MAPSIZE (this is nested inside the j for loop)
       for (k=0;k<MAPSIZE;k++)
       {
           //Set Map[j][k] to a dash
           Map[j][k] = '-';
       }
   }

   //Set Position.row to 0
   Position.Row =0;

   //Set Position.col to 0
   Position.Col = 0;

   //Set Map[Position.row][Position.col] to 'S' to signal the starting position
   Map[Position.Row][Position.Col] = 'S';
   displaycurrentMoveInMAP(' ', Map);

   //Create a for loop from i = 0 to i < the string length of DirectionList
  
   int len= strlen(DirectionList);
   for(i=0;i<len;i++)
   {
      
       //if DirectionList[i] is 'N', then call MoveNorth() and pass PositionPtr
       if (DirectionList[i] == 'N')
           MoveNorth(PositionPtr);
       //else if DirectionList[i] is 'S', then call MoveSouth() and pass PositionPtr
       else if (DirectionList[i] == 'S')
           MoveSouth(PositionPtr);
       //else if DirectionList[i] is 'W', then call MoveWest() and pass PositionPtr
       else if (DirectionList[i] == 'W')
           MoveWest(PositionPtr);
       //else call MoveEast() and pass PositionPtr
       else if (DirectionList[i] == 'E')
           MoveEast(PositionPtr);


       //Set Map[Position.row][Position.col] to 'X' to signal a move to this position
       Map[Position.Row][Position.Col] = 'X' ;
       displaycurrentMoveInMAP(DirectionList[i], Map);

   }

   //Set the last Map point (Map[Position.row][Position.col]) to 'E' to signal the ending position
   Map[Position.Row][Position.Col] = 'E';
   displaycurrentMoveInMAP(' ', Map);
  

   //Create a for loop from j = 0 to j < MAPSIZE
   for(j=0;j<MAPSIZE;j++)
   {
       //Create a for loop from k = 0 to k < MAPSIZE (this is nested inside the j for loop)
       for(k=0;k<MAPSIZE;k++)
       {
           //Use "%c " to print Map[j][k].
           printf("%c ",Map[j][k]);

           //Use sprintf() to print Map[j][k] to buffer.
           sprintf(buffer, "%c",Map[j][k]);

           //Use fputs() to write buffer to TreasureMap (the file TreasureMap will contain NO spaces and NO linefeeds)
           fputs (buffer,TreasureMap);
       }

       //Use printf() to print two blanks lines – this will put blank lines between each row
       printf("\n\n");
   }

  
   system("pause");

   //Call fclose() with DirectionFile to close it.
   fclose(DirectionFile);
  
   //Call fclose() with TreasureMap to close it
   fclose(TreasureMap);
}


void MoveNorth(RowCol *PositionPtr)
{
   // To move north, you need to subtract 1 from PositionPtr->row.
   // Before doing so, you need to check if subtracting
   // one makes you move outside of the map
   // if subtracting 1 makes PositionPtr->row < 0,
   // then you have moved outside of the map;
   //therefore, the move is not valid and should be skipped.

   if (PositionPtr->Row - 1 >= 0)
       PositionPtr->Row = PositionPtr->Row - 1;

}

void MoveSouth(RowCol *PositionPtr)
{
   //To move south, you need to add 1 to PositionPtr->row.
   //Before doing so, you need to check if adding one makes you move
   //outside of the map
   //if adding 1 makes PositionPtr->row > 10
   //then you have moved outside of the map;
   //therefore, the move is not valid and should be skipped.;

   if (PositionPtr->Row + 1 < MAPSIZE )
       PositionPtr->Row = PositionPtr->Row + 1;


}

void MoveEast(RowCol *PositionPtr)
{
   //To move east, you need to add 1 to PositionPtr->col.
   //Before doing so, you need to check if adding one makes
   //you move outside of the map
   //if adding 1 makes PositionPtr->col > 10,
   //then you have moved outside of the map;
   //therefore, the move is not valid and should be skipped.

   if (PositionPtr->Col + 1 < MAPSIZE )
       PositionPtr->Col = PositionPtr->Col + 1;
}
void MoveWest(RowCol *PositionPtr)
{
   //To move west, you need to subtract 1 from PositionPtr->col.
   //Before doing so, you need to check if subtracting one
   //makes you move outside of the map
   // if subtracting 1 makes PositionPtr->col < 0,
   //then you have moved outside of the map;
   //therefore, the move is not valid and should be skipped.

   if (PositionPtr->Col - 1 >= 0)
       PositionPtr->Col = PositionPtr->Col - 1;


}

void get_command_line_params(int argc, std::vector<std::string> argv)
{
  
   std::string args;
   bool bFoundDirectionsFile = false;
   bool bFoundMapFile = false;
   std::size_t foundat ;
   std::string str;

   //Create a for loop with argc to go through each value of argv
   for(int a=0;a<argc;a++)
   {
       //Look for an argv of DIRECTIONS=  
       //When found, take the string after the = as the value to store in
       //DirectionsFilename.
       args = argv[a];
      

       foundat = args.find(findDirectionFileString);
       if (foundat!=std::string::npos && bFoundDirectionsFile == false)
       {  
      
           // copying the contents of the string to char array
           //strcpy(DirectionsFilename, args.substr(foundat).c_str());   
           str = args.substr(foundat+strlen(findDirectionFileString)).c_str();
           str.copy(DirectionsFilename, str.length());
           bFoundDirectionsFile = true;
       }

       //Look for an argv of MAP=  
       //When found, take the string after the = as the value to store
       //in MapFilename.
       foundat = args.find(findMAPFileString);
       if (foundat!=std::string::npos && bFoundMapFile == false)
       {  
      
           //copying the contents of the string to char array
           //strcpy(MapFilename, args.substr(foundat).c_str());   
           str = args.substr(foundat+strlen(findMAPFileString)).c_str();
           str.copy(MapFilename, str.length());
           bFoundMapFile = true;
       }
   }

   //After looking at all of the strings in argv,
   //if you do not have a value for either DirectionsFilename
   //or MapFilename,
   //then print the message  
   //"DIRECTIONS= and MAP= must be given on the command line"
   //and exit

   if (!bFoundDirectionsFile || !bFoundMapFile)
   {
       printf("DIRECTIONS= and MAP= must be given on the command line");
       exit(0);
   }

}

void displaycurrentMoveInMAP(char cdirection, char dMap[MAPSIZE][MAPSIZE])
{
   string sdirection;
   if (cdirection == 'E')
       sdirection = "EAST DIRECTION";
   else if (cdirection == 'W')
       sdirection = "WEST DIRECTION";
   else if (cdirection == 'N')
       sdirection = "NORTH DIRECTION";
   else if (cdirection == 'S')
       sdirection = "SOUTH DIRECTION";
   else
       sdirection = "START OR END POSITION";

   cout << "\nCURRENT MOVE IN " << sdirection << "\n\n\n";

   int j,k;
  
   //Create a for loop from j = 0 to j < MAPSIZE
   for(j=0;j<MAPSIZE;j++)
   {
       //Create a for loop from k = 0 to k < MAPSIZE (this is nested inside the j for loop)
       for(k=0;k<MAPSIZE;k++)
       {
           //Use "%c " to print Map[j][k].
           printf("%c ",dMap[j][k]);
       }
       //Use printf() to print two blanks lines – this will put blank lines between each row
       printf("\n\n");
   }

   system("pause");

}

OUTPUT : WRONG COMMAND LINE


D:\Users\jds\Documents\Visual Studio 2010\Projects\WriteFileTest\Debug>WriteFile
Test
DIRECTIONS= and MAP= must be given on the command line


D:\Users\jds\Documents\Visual Studio 2010\Projects\WriteFileTest\Debug>WriteFile
Test d m
DIRECTIONS= and MAP= must be given on the command line

OUTPUT : WRONG FILE NAME


D:\Users\jds\Documents\Visual Studio 2010\Projects\WriteFileTest\Debug>WriteFile
Test DIRECTIONS=directionsnotfound.txt MAP=map.txt
DirectionFile did not open: No such file or directory

INPUT FILE : EXECUTION WITH CORRECT DIRECTIONS.TXT FILE

NNSSEESSWW

OUTPUT FILE : EXECUTION WITH CORRECT DIRECTIONS.TXT FILE


D:\Users\jds\Documents\Visual Studio 2010\Projects\WriteFileTest\Debug>WriteFile
Test DIRECTIONS=directions.txt MAP=map.txt

CURRENT MOVE IN START OR END POSITION


S - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

Press any key to continue . . .

CURRENT MOVE IN NORTH DIRECTION


X - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

Press any key to continue . . .

CURRENT MOVE IN NORTH DIRECTION


X - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

Press any key to continue . . .

CURRENT MOVE IN SOUTH DIRECTION


X - - - - - - - - -

X - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

Press any key to continue . . .

CURRENT MOVE IN SOUTH DIRECTION


X - - - - - - - - -

X - - - - - - - - -

X - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

Press any key to continue . . .

CURRENT MOVE IN EAST DIRECTION


X - - - - - - - - -

X - - - - - - - - -

X X - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

Press any key to continue . . .

CURRENT MOVE IN EAST DIRECTION


X - - - - - - - - -

X - - - - - - - - -

X X X - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

Press any key to continue . . .

CURRENT MOVE IN SOUTH DIRECTION


X - - - - - - - - -

X - - - - - - - - -

X X X - - - - - - -

- - X - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

Press any key to continue . . .

CURRENT MOVE IN SOUTH DIRECTION


X - - - - - - - - -

X - - - - - - - - -

X X X - - - - - - -

- - X - - - - - - -

- - X - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

Press any key to continue . . .

CURRENT MOVE IN WEST DIRECTION


X - - - - - - - - -

X - - - - - - - - -

X X X - - - - - - -

- - X - - - - - - -

- X X - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

Press any key to continue . . .

CURRENT MOVE IN WEST DIRECTION


X - - - - - - - - -

X - - - - - - - - -

X X X - - - - - - -

- - X - - - - - - -

X X X - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

Press any key to continue . . .

CURRENT MOVE IN START OR END POSITION


X - - - - - - - - -

X - - - - - - - - -

X X X - - - - - - -

- - X - - - - - - -

E X X - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

Press any key to continue . . .
X - - - - - - - - -

X - - - - - - - - -

X X X - - - - - - -

- - X - - - - - - -

E X X - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

- - - - - - - - - -

Press any key to continue . . .
D:\Users\jds\Documents\Visual Studio 2010\Projects\WriteFileTest\Debug>

OUTPUT FILE: MAP.TXT

X---------X---------XXX---------X-------EXX---------------------------------------------------------

Add a comment
Know the answer?
Add Answer to:
Create a #define called MAPSIZE. Set to 10. Create global variables DirectionsFilename and MapFilename. Use char...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • c++ help please! Create a 2D character array in your main function and use nested for...

    c++ help please! Create a 2D character array in your main function and use nested for loops to fill the array with the letter ‘e’ to represent empty spaces. Create a function to print the board on the screen using a nested for loop. The function header is: void printBoard (char board [][3]) Create a function that checks whether a particular space has already been filled. If the space is filled it returns a boolean value of true, otherwise false....

  • use MatLab to answer these questions 1. (10 points) Create an m-file called addup.m Use a...

    use MatLab to answer these questions 1. (10 points) Create an m-file called addup.m Use a for loop with k = 1 to 8 to sum the terms in this sequence: x(k) = 1/3 Before the loop set sumx = 0 Then add each term to sumx inside the loop. (You do not need to store the individual values of the sequence; it is sufficient to add each term to the sum.) After the loop, display sumx with either disp()...

  • This is my code for my game called Reversi, I need to you to make the...

    This is my code for my game called Reversi, I need to you to make the Tester program that will run and complete the game. Below is my code, please add comments and Javadoc. Thank you. public class Cell { // Displays 'B' for the black disk player. public static final char BLACK = 'B'; // Displays 'W' for the white disk player. public static final char WHITE = 'W'; // Displays '*' for the possible moves available. public static...

  • The last element in each array in a 2D array is incorrect. It’s your job to...

    The last element in each array in a 2D array is incorrect. It’s your job to fix each array so that the value 0 is changed to include the correct value. In the first array, the final value should be the length of the first array. In the second array, the final value should be the sum of the first value, and the second to last value in the array. In the third array, the final value should be the...

  • Code should be in C# Create a class called SavingsAccount.  Use a static variable called annualInterestRate to...

    Code should be in C# Create a class called SavingsAccount.  Use a static variable called annualInterestRate to store the annual interest rate for all account holders.  Each object of the class contains a private instance variable savingsBalance, indicating the amount the saver currently has on deposit. Provide method CalculateMonthlyInterest to calculate the monthly interest by multiplying the savingsBalance by annualInterestRate divided by 12 – this interest should be added to savingsBalance.  Provide static method setAnnualInterestRate to set the annualInterestRate to a new value....

  • Can someone please complete the "allTheQueensAreSafe" function? #include <stdio.h> #include <stdlib.h> void printBoard(int *whichRow, int n)...

    Can someone please complete the "allTheQueensAreSafe" function? #include <stdio.h> #include <stdlib.h> void printBoard(int *whichRow, int n) {    int row, col;    for (row = 0; row < n; row++)    {        for (col = 0; col < n; col++)        {            printf("%c", (whichRow[col] == row) ? 'Q' : '.');        }        printf("\n");    }    printf("\n"); } int allTheQueensAreSafe(int *whichRow, int n, int currentCol) {    // TODO: Write a function that returns 1 if all the queens represented by    // this array are safe (i.e., none...

  • Concepts: multi-dimension array and the Knight's Tour Problem A chess board consists of an 8 x 8 "array" of squares: int board[ROW][COL]={0}; A knight may move perpendicular to the edges o...

    Concepts: multi-dimension array and the Knight's Tour Problem A chess board consists of an 8 x 8 "array" of squares: int board[ROW][COL]={0}; A knight may move perpendicular to the edges of the board, two squares in any of the 4 directions, then one square at right angles to the two-square move. The following lists all 8 possible moves a knight could make from board [3][3]: board[5][4] or board[5][2] or board[4][5] or board[4][1] or board[1][4] or board[1][2] or board[2][5] or board[2][1]...

  • Make sure to include: Ship.java, ShipTester.java, Location.java, LocationTester.java, Grid.java, GridTester.java, Player.java, PlayerTester.java, battleship.java. please do every...

    Make sure to include: Ship.java, ShipTester.java, Location.java, LocationTester.java, Grid.java, GridTester.java, Player.java, PlayerTester.java, battleship.java. please do every part, and include java doc and comments Create a battleship program. Include Javadoc and comments. Grade 12 level coding style using java only. You will need to create a Ship class, Location class, Grid Class, Add a ship to the Grid, Create the Player class, the Battleship class, Add at least one extension. Make sure to include the testers. Starting code/ sample/methods will be...

  • This is java. Goal is to create a pacman type game. I have most of the...

    This is java. Goal is to create a pacman type game. I have most of the code done just need to add in ghosts score dots etc. Attached is the assignment, and after the assignment is my current code. import java.awt.Color; import java.awt.Dimension; import java.awt.Image; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.io.File; import java.io.FileNotFoundException; import java.util.Arrays; import java.util.Scanner; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; public class Maze extends JFrame implements KeyListener { private static final String[] FILE = {...

  • I need a basic program in C to modify my program with the following instructions: Create...

    I need a basic program in C to modify my program with the following instructions: Create a program in C that will: Add an option 4 to your menu for "Play Bingo" -read in a bingo call (e,g, B6, I17, G57, G65) -checks to see if the bingo call read in is valid (i.e., G65 is not valid) -marks all the boards that have the bingo call -checks to see if there is a winner, for our purposes winning means...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT