[Solved]Lab 631 Polymorphism Part 2 Objectives Familiarize Student Polymorphism Using Objects Diff Q37108987

solve in c++Lab 6.3.1 Polymorphism: part 2 Objectives Familiarize the student with: * polymorphism, or using objects of different types through a common interface; * using polymorphism in real programs Scenario Let’s assume you write a code for the game of checkars (aka draughts). There are two types of pieces in this game: man and kings. You need to implement classes (one abstract for the pieces and two separate classes for the men and the kings) to check if the moves are correct. Men can only move one ficeld forward along diagonals. In international checkers, kings can move any distance forward and backward aong unblockad diagonals. To simplty your program, assume that the board is empty and you only have to check one piece at a time. The starting position for one of the peces is the bl ficld. Call a check method from the pointer to the base (Picce) chss Example input Call a method to check if Piece(Man) can be moved from bl to c2 ca 11 a method to check if Piece(King ) can be moved from bl to d3 call a nethod to check İf Piece(Man) can be moved from bi to d3 Example output true true false Lab 6.3.1 Polymorphism: part 1 Objectives Familiarize the student with: * implementing multiple classes with the same iterface; polymorphism, or usng objects of different types through a common interface Scenario write four classes to mplement the prmtng of different kinds of trees (they should consist of vสy simple ASCII charact&s, le、.*. and). One of the classes is a base for the other three. In the base class, you should create a draw method-it’s the only method of this class and it’s a virtual method. Next-in the derived classes, mplement this method with three different versions of drawing. In the man function, create a table of three pointers to objects of the base class. Then create three objects of different knds of trees and assign pointers to them to cells of the previously created table. After this, m the for kop, iterate ova the table and call the draw method from every ekment of the tabie Example input Just the for loop in the code Example output Drawing 1 Drawing 21 Drawing3 Show transcribed image text Lab 6.3.1 Polymorphism: part 2 Objectives Familiarize the student with: * polymorphism, or using objects of different types through a common interface; * using polymorphism in real programs Scenario Let’s assume you write a code for the game of checkars (aka draughts). There are two types of pieces in this game: man and kings. You need to implement classes (one abstract for the pieces and two separate classes for the men and the kings) to check if the moves are correct. Men can only move one ficeld forward along diagonals. In international checkers, kings can move any distance forward and backward aong unblockad diagonals. To simplty your program, assume that the board is empty and you only have to check one piece at a time. The starting position for one of the peces is the bl ficld. Call a check method from the pointer to the base (Picce) chss Example input Call a method to check if Piece(Man) can be moved from bl to c2 ca 11 a method to check if Piece(King ) can be moved from bl to d3 call a nethod to check İf Piece(Man) can be moved from bi to d3 Example output true true false
Lab 6.3.1 Polymorphism: part 1 Objectives Familiarize the student with: * implementing multiple classes with the same iterface; polymorphism, or usng objects of different types through a common interface Scenario write four classes to mplement the prmtng of different kinds of trees (they should consist of vสy simple ASCII charact&s, le、.*. and). One of the classes is a base for the other three. In the base class, you should create a draw method-it’s the only method of this class and it’s a virtual method. Next-in the derived classes, mplement this method with three different versions of drawing. In the man function, create a table of three pointers to objects of the base class. Then create three objects of different knds of trees and assign pointers to them to cells of the previously created table. After this, m the for kop, iterate ova the table and call the draw method from every ekment of the tabie Example input Just the for loop in the code Example output Drawing 1 Drawing 21 Drawing3
Expert Answer
Answer to Lab 6.3.1 Polymorphism: part 2 Objectives Familiarize the student with: * polymorphism, or using objects of different ty… . . .
OR

