CS162 – Module

$ 29.99
Category:

Description

Goals-
write, compile, and test a program that uses multiple files; upload it to flip for testing; submit
it to TEACH
create and use simple makefiles and simple archiving of all files in a zip file compile a program written in multiple source code files

This is the first module in what will be a larger program. They are first graded S/U. When the larger program is completed it will receive a numeric score to be used in your final grade calculation. To receive a grade of S this module bust be completed to at least 90% of expectations. Talk to your grader. You will receive feedback and a chance to resubmit if necessary.

You will create a program that uses a Critter class to move around a Grid, which is also a class. The Critter and the Grid classes will be in separate files.

The Critter class will have a data member to count the number of moves made. It will also need data members to hold the current x and y coordinates. It will have a member function that randomly moves it one space in one of 4 directions. You will create both the source and header files for the class.

The Grid class has a 2D array data member. This will be an array of type character. It will have an updateLocation() function that will be used by the Critter class to pass the new location of the Critter to be displayed.

For the array ou will use a space character, ‘ ‘ for empty and a single ‘C’ for the location of the
Critter. The Grid will have one Critter that moves around. The starting location will be random. The Critter will move around until it would exit the gird. In that case it is squashed. The program should terminate normally and tell the user how many steps the Critter took. After every move the grid will be displayed to the user.

Hint: For testing, use small arrays. There’s only one Critter after all. 

You will create a program that prompts the user for the number of rows and columns. It must be at least 1 x 1. It will create the Grid and Critter, run the simulation, display the grid after each move, and inform the user when the Critter gets squashed showing the number of moves made.

Once your program is working and you have eliminated the bugs create a makefile to build your program. You do not need a complicated makefile. You can have a single target that just includes what you typed into the command line for testing.

Include a second target clean that removes extraneous files such as .o files or a.out.

HINT: If you look at the assignment you’ll see that much of this module is similar to what is required in the assignment. Develop the module while doing the design for the assignment. You can avoid making the same mistake(s) twice.

On The Horizon

Remember we are laying the foundation for future parts of your program! Yes, this is cumbersome for what it does. What’s coming? More than one Critter moving around. More than one type of Critter. What would that mean for technical skills? Inheritance. Pointers to objects. We do a lot with pointers so you might begin reviewing your notes and the test. 

Grading

Modules will be graded S/U. This module is the first part of the cumulative modular program (Cump) which will be graded. These criteria are given specifically for this module.

Programming style- 10%

Create the source and header file for the Critter class- 20%

Create the source and header file for the Grid class- 20%

Create and execute a program using both classes, and verify the results- 20%

Create a makefile with targets for your program and clean – 20%

Submit all files in zip archive- 10%

Reviews

There are no reviews yet.

Be the first to review “CS162 – Module”

Your email address will not be published. Required fields are marked *