Question

with C++ You will create a program that uses a Critter class to move around a...

with C++ 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. Files should include: Critter.h Critter.cpp Grid.h Grid.cpp Main.cpp

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
with C++ You will create a program that uses a Critter class to move around a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • *Using C++* You will create a program that uses a Critter class to move around a...

    *Using C++* 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...

  • Program must be written in C++: The goal for this Programming Project is to create a...

    Program must be written in C++: The goal for this Programming Project is to create a simple two-dimensional predator-prey simulation. In this simulation the prey are ants and the predator are doodlebugs. These critters live in a world composed of 20 x 20 grid of cells. Only one critter may occupy a cell at a time. The grid is enclosed, so a critter is not allowed to move off the edges of the world. Time is simulated in time steps....

  • In c++ Write a program that contains a class called Player. This class should contain two...

    In c++ Write a program that contains a class called Player. This class should contain two member variables: name, score. Here are the specifications: You should write get/set methods for all member variables. You should write a default constructor initializes the member variables to appropriate default values. Create an instance of Player in main. You should set the values on the instance and then print them out on the console. In Main Declare a variable that can hold a dynamcially...

  • A mechanical turtle walks around a room under the control of a C++ program. Note: There...

    A mechanical turtle walks around a room under the control of a C++ program. Note: There is no animation of the turtle walking around the room The turtle holds a pen in one of two positions, up or down. When the pen is down the turtle draws out the shape as it moves. When the pen is up, the turtle moves about freely without writing anything. For this assignment you will write a program to simulate the operation of the...

  • ASSIGNMENT: Create a program to do the following: BONUS: A bonus of 20 points if you create the p...

    ASSIGNMENT: Create a program to do the following: BONUS: A bonus of 20 points if you create the program in such a way that there is no limit on the number of names to be handled. 1) Read in names to sort until the user types the “enter” key as the first character of a “C-type” string (the maximum number of names is 20, there is not a maximum length to a name), using a two dimensional array of characters....

  • Create a C++ program to : Prompt user for seven test score Store the scores into...

    Create a C++ program to : Prompt user for seven test score Store the scores into an array Print the array before and after sorting Print the test average Convert the average to letter grade Search for a test score 90, using linear search Print, if test score 90 was found and at what position Add Comments SEPARATE THE FILES INTO 3 : header.h, functions.cpp, main.cpp

  • Write a program in C++ that uses a class template to create a set of items....

    Write a program in C++ that uses a class template to create a set of items. . . The Problem Write program that uses a class template to create a set of items. The program should: 1. add items to the set (there shouldn't be any duplicates) Example: if your codes is adding three integers, 10, 5, 10, then your program will add only two values 10 and 5 Hint: Use vectors and vector functions to store the set of...

  • *** C++ *** Create a class called Student that contains a first name ( string) and...

    *** C++ *** Create a class called Student that contains a first name ( string) and an student id number (type long).     1. Include a member function called get_data( ) to get data from the user for insertion into the object,     2. Also include a function called display_data( ) that displays the student data. Then write a complete program that uses the class to do some computation. Your main function, main( ), should create a Dynamic Array of...

  • write C++ program Create a class named Bicycle with one public pure virtual function showFeatures(). Create...

    write C++ program Create a class named Bicycle with one public pure virtual function showFeatures(). Create the two classes MountainBike and BeachCruiser that both publicly inherit from Bicycle. Please add necessary member variables and functions to each class. The showFeatures() function shows the details about a bicycle. should have main.cpp Bicycle.h Bicycle.cpp  MountainBike .h  MountainBike.cpp  BeachCruiser.h  BeachCruiser.cpp

  • Hello I am confused about this C++ program. I need to create a payroll C++ program...

    Hello I am confused about this C++ program. I need to create a payroll C++ program following these steps. Source file structure Your program will consist of three source files: main.cpp the main program Payroll.hppclass declaration for the Payroll class. Make sure you have an include guard. Payroll.cpp Payroll's member functions Class definition Create a Payroll class definition. The class has private members which originate from user input: number of hours worked hourly rate float float - and private members...

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