Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question

In C++ programming Language using Visual Studio(Not Visual Studio Code)

Suppose you have a vector of integer data, say { 1, 5, 4, 2, 3 }
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
----------------------

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education