Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assignment 11 Type solution and submit as an attachment. I. Create the cla Opera

ID: 3777809 • Letter: A

Question

Assignment 11 Type solution and submit as an attachment. I. Create the cla OperationA that hak the following propertie: protected int fields named ay and result. protected void method ramed oper O that takes o parameters. It asigns the product of a aad y to resvA. publie default constructor that to both aad and eals operateO public acomor methods for all igned to the field. 2. Create the class operationB that thr following propertimo publicly inherits OperationA protected overridden Operate0 that awigae the dirtance between a and s to arrait Dirtance the aleolute whee their difference. public default constructor that aaigas l to both aad y aad calls operate O public overridden ret anne or method for a and y that dupliratee thr bodies of the et ance or 3 Create the class operationC that has the following propertie: publicly inherits operationA protected overridden Operateo that assigns the sum of the square of and to public default constructor that areime I to both zaad saad calls operateO puble overridden set aneessor methods for and that duplirates tle bodies of the set accessor methods of la the rain, create an objeet for each class. Next, display result foe each object by ealing the get aereseor method for result with the of its elass on the same line. Afterward, rodity the a vlue all the objects them, diplay for each object again in the before. Lait, modify v like you did for and display

Explanation / Answer

#include #include void run(); void printMap(); void initMap(); void move(int dx, int dy); void update(); void changeDirection(char key); void clearScreen(); void generateFood(); char getMapValue(int value); // Map dimensions const int mapwidth = 20; const int mapheight = 20; const int size = mapwidth * mapheight; // The tile values for the map int map[size]; // Snake head details int headxpos; int headypos; int direction; // Amount of food the snake has (How long the body is) int food = 3; // Determine if game is running bool running; int main() { run(); return 0; } // Main game function void run() { // Initialize the map initMap(); running = true; while (running) { // If a key is pressed if (kbhit()) { // Change to direction determined by key pressed changeDirection(getch()); } // Upate the map update(); // Clear the screen clearScreen(); // Print the map printMap(); // wait 0.5 seconds _sleep(500); } // Print out game over text std::cout