
Concept explainers
In C++ programming Language using Visual Studio(Not Visual Studio Code)
Suppose you have a
The data may eventually need to be transformed into some other form, say by sorting the data values for instance
This would turn the vector into { 1, 2, 3, 4, 5 }
Or say I wanted to take the original vector { 1, 5, 4, 2, 3 } and remove all the even numbers from it
This would turn the vector into { 1, 5, 3 }
So in general terms, we start with an input vector, and it somehow gets transformed into its transformed vector
The options really are almost limitless, but we will keep things simple for this checkpoint assignment
We will be developing a base/derived class relationship that can perform custom transformations of data at runtime
Your submission must follow OOP best practices that incorporates topics in Gaddis' textbook chapters 13 through 15
{ 1, 5, 4, 2, 3 } ==========(SORT)==========> { 1, 2, 3, 4, 5 }
{ 1, 5, 4, 2, 3 } ======(REMOVE EVENS)======> { 1, 5, 3 }
{ 1, 5, 4, 2, 3 } ========(CONSTANT)========> { 1, 5, 4, 2, 3 }
Start with this collection of files and incorporate them into a project using whichever IDE you are comfortable with
The main.cpp file will do all the heavy lifting of creating the objects mentioned here and testing their expected behaviors
The Transformation.h file will hold your code for part one
The Constant.h file will hold your code for part two
The Sort.h file will hold your code for part three
You will need to add code in one section of the main.cpp file as described below to complete part four
PART 1) The base class for this relationship will be called Transformation and has the following properties that need developing:
- Every Transformaton object maintains a vector of integer values which can only be directly accessed by itself and its derived classes
- The only constructor for this base class takes a vector of integer values as its only parameter, and copies all its values in order into the maintained vector
- A function called Print() will print every element of the maintained vector, space separated, with a newline character when exhausted
- A function called GetVectorCopy() will simply return a copy of the maintained vector
- A function called Transform() will do something different to the maintained vector for each derived class, but by itself has no true default behavior
PART 2) One derived class of Transformation to develop will be called Constant
- The only constructor for this derived class takes a vector of integer values as its only parameter and passes it along to its base class
- A function called Transform() will do nothing at all to the maintained vector, thus the name of the class type
PART 3) A second derived class of Transformation to develop will be called Sort
- The only constructor for this derived class takes a vector of integer values as its only parameter and passes it along to its base class
- A function called Transform() will sort the maintained vector, thus the name of the class type
PART 4) You will need to add code to the PrintHeaderForElement() function inside of the main.cpp file
- For a given element, if it is a pointer to a Constant object print "CONSTANT: "
- For a given element, if it is a pointer to a Sort object print "SORT: "
- Which C++ keyword can be used at runtime to determine an object's type?
Now the program should run without issue, and your output should match what is seen below
If there are errors in your code and/or architecture, then the test cases will halt and tell you one part of the requirements that are lacking
Zip up your four C++ source code files and submit your solution here to Blackboard within your time window
You may email me your submission if you are having technical difficulties, but the email must still come in within your time window
Expected output of this completed program
--------BEFORE--------
CONSTANT: 1 6 3 4 2
SORT: 11 65 35 14 3 99
CONSTANT: 2 6 5 14 2 99 103232
SORT: 11 8 5 2 94 15 3
CONSTANT: 1 7 13 14 12 11 11 8
---------AFTER--------
CONSTANT: 1 6 3 4 2
SORT: 3 11 14 35 65 99
CONSTANT: 2 6 5 14 2 99 103232
SORT: 2 3 5 8 11 15 94
CONSTANT: 1 7 13 14 12 11 11 8
----------------------

Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 5 images

- The purpose is to write a program with 2D arrays that will display Knight's Tour. Knight's Tour is a fascinating problem that is done on an electronic chessboard with a knight. Starting at any location on the chessboard, a knight proceeds to move on the board in such a manner that all positions on the chessboard are visited, once and once only. The knight may only move according to the rules of chess playing. The matrixes below show a sequence of knight moves that starts from the top-left corner. In most cases, the knight is locked in place and can go no farther. Note: there are only 3 legal knight moves from the 44 locations and they have already been visited. 01 60 39 34 31 18 09 6438 35 32 61 10 63 30 1759 02 37 40 33 28 19 0836 49 42 27 62 11 16 2943 58 03 50 41 24 07 2048 51 46 55 26 21 12 1557 44 53 04 23 14 25 0652 47 56 45 54 05 22 13 01 22 39 20 03 18 09 1600 37 02 23 08 15 04 1335 40 21 38 19 12 17 1000 00 36 41 24 07 14 0500 34 00 32 00 28 11 2600 00 00 00 42 25 06 2900…arrow_forwardThe purpose is to write a program with 2D arrays that will display Knight's Tour. Knight's Tour is a fascinating problem that is done on an electronic chessboard with a knight. Starting at any location on the chessboard, a knight proceeds to move on the board in such a manner that all positions on the chessboard are visited, once and once only. The knight may only move according to the rules of chess playing. The matrixes below show a sequence of knight moves that starts from the top-left corner. In most cases, the knight is locked in place and can go no farther. Note: there are only 3 legal knight moves from the 44 locations and they have already been visited. 01 60 39 34 31 18 09 6438 35 32 61 10 63 30 1759 02 37 40 33 28 19 0836 49 42 27 62 11 16 2943 58 03 50 41 24 07 2048 51 46 55 26 21 12 1557 44 53 04 23 14 25 0652 47 56 45 54 05 22 13 01 22 39 20 03 18 09 1600 37 02 23 08 15 04 1335 40 21 38 19 12 17 1000 00 36 41 24 07 14 0500 34 00 32 00 28 11 2600 00 00 00 42 25 06 2900…arrow_forwardWrite answer in c++arrow_forward
- Write a C program that Defines a two-dimensional array of 7 rows and 7 columns Promotes the user to fill the array with integes. Tests whether a two-dimensional array has four consecutive numbers of the same value, either horizontally, vertically, or diagonally, and displays "Pattern Found" if the array contains four consecutive numbers with the same value. Otherwise, display Pattern NOT Found. Here are some examples of the Pattern Found case 0 103161 016 86 0 1 0 10316 1 0103161 0 103161 0168601 01686 01 016 86 0 1 5621 29 5521829 5621629 9621 829 6 5 6119 1 6 5 6119 1 6 56 61 9 1 6 96119 1 1361 4 07 1561 4 0 7 1361 4 07 13914 07 33334 07 3533 4 07 36334 07 3339407arrow_forwardIntegers are read from input and stored into a vector until 0 is read. If the vector's last element is odd, output the odd elements in the vector. Otherwise, output the even elements in the vector. End each number with a newline. Ex: If the input is -9 12 -6 1 0, the vector's last element is 1. Thus, the output is: -9 1 Note: (x % 2 != 0) returns true if x is odd. int value; int i; bool isodd; 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 } cin >> value; while (value != 0) { } for (i = 0; i > value; Check return 0; 1 Next level 2 X 1: Compare output 3 4 For input -9 12 -6 1 0, the vector elements are -9, 12, -6, and 1. The last element, 1, is odd. The odd elements in the vector, -9 and 1, are output, each on a new line. Not all tests passed. 2 V 3arrow_forwardIntegers are read from input and stored into a vector until 0 is read. If the vector's last element is odd, output the odd elements in the vector. Otherwise, output the even elements in the vector. End each number with a newline. Ex: If the input is -9 12 -6 1 0, the vector's last element is 1. Thus, the output is: -9 1 Note: (x % 2!= 0) returns true if x is odd. 4 5 int main() { 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20} vector vect1; int value; int i; bool isodd; cin >> value; while (value != 0) { vect1.push_back(value); cin >> value; } V* Your code goes here */ return 0; 2 3arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





