Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Bartleby Related Questions Icon
Related questions
Question
Transcribed Image Text:Introduction
In this project, you will complete a C++ class by writing a copy constructor, destructor, and assignment
operator. Furthermore, you will write a tester class and a test program and use Valgrind to check that
your program is free of memory leaks. Finally, you will submit your project files on GL. If you have
submitted programs on GL using shared directories (instead of the submit command), then the
submission steps should be familiar.
In this project we develop an application which holds the information about a digital art piece. There
are two classes in this project.
• The Random class generates data. The implementation of this class is provided. It generates
random int numbers for colors. To create an object of this class we need to specify min and max
values for the constructor. The colors fall between 30 and 37 inclusively.
The Art class generates random colors and stores the color values. You implement the Art class.
An object of the Art class is a digital masterpiece. The class stores the color values for every part
of the masterpiece in a cell of a 2D array. The following figure presents multiple examples of a
masterpiece presentation.
The following figure represents the main data structure in this project. It is a 2d structure.
Assignment
Step 1: Create your working directory
Create a directory in your GL account to contain your project files. For example, cs341/projo.
Step 2: Copy the project files
You can right-click on the file linkes on this page and save-as in your computer. Then, transfer the files
to your GL account using SFTP.
For this project, you are provided with the skeleton .h and.cpp files, a sample driver, and the output of
driver program:
. art.h - The interface for all Random and Art classes.
art.cpp -The skeleton for the Art class implementation.
driver.cpp - The sample driver/test program.
driver.pdf - The output of sample driver/test program.
Step 3: Complete the Art class
The Art class has three data members. The member variable m_masterPiece holds a pointer to an
array of pointers to multiple arrays. The class needs to allocate required memory dynamically. Every
cell in this 2d structure holds an int number which represents a color code. The member variable
m_numRows and m_numColumns define the size of the masterpiece. The variable m_numRows
defines the height and the variable m_numColumns defines the width of the object.
Art:Art()
This is the default constructor. It creates an empty object. An empty object does not hold any memory.
The constructor must initialize all member variables. The empty object has zero height and width.
Art::Art(int rows, int columns)
This is the constructor. It initializes all member variables and it allocates required memory if neccessary.
If the user passes invalid parameters such a a negative size the constructor creates an empty object.
Art: Art
This is the destructor and it deallocates the memory.
void Art:clear()
This function deallocates all memory and reinitializes all member variables to default values. It clears
Transcribed Image Text:the current object to an empty object.
void Art:create(int seed)
This function generates random color code and inserts it into m_masterPiece. To generate random
code the function must create a Random object initialized for generating int numbers. Please note, you
do not modify the Random class. You only use the Random class. The parameter seed is the seed
value to be used by the Random class.
Art:Art(const Art& rhs)
This is the copy constructor. It creates a deep copy of the rhs object. Deep copy means the new object
has its own memory allocated.
const Art& Art:operator=(const Art& rhs)
This is the assignment operator. It creates a deep copy of rhs. Reminder: an assignment operator
needs the protection against self-assignment.
bool Art:appendToRight(const Art& rhs)
This function appends the rhs object to the right of the current object. The append operation only
happens if both objects have the same height or either object is empty. If the operation is successful
the function returns true otherwise it returns false. The function allows for self-append, an object can
be appended to the right of itself. Please note, appending requires reallocation of memory.
bool Art:appendToBottom(const Art& bottom)
This function appends the rhs object to the bottom of the current object. The append operation only
happens if both objects have the same width or either object is empty. If the operation is successful
the function returns true otherwise it returns false. The function allows for self-append, an object can
be appended to the bottom of itself. Please note, appending requires reallocation of memory.
void Art::dumpColors(string pixel)
This function prints the object to the standard output. The implementation of this function is provided.
You do not need to modify this function. This function is for debugging purposes. The parameter pixel
is the character or the string that will be printed. Using a utf-8 character such as "\u2588" can create
interesting effects. If you are using a Windows computer for development you can use ASCII
characters such as "#"since Windows shell does not support utf-8 by default. The File windows.pdf
provides instruction to activate the support of UTF characters.
void Art:dumpValues()
This function prints the color codes to the standard output. The implementation of this function is
provided. You do not need to modify this function. This function is for debugging purposes.
Step 4: Test your code
The sample driver.cpp file will not be accepted as a test file.
.
The name of the test file must be mytest.cpp.
The mytest.cpp file contains the Tester class, and the main function.
. The test cases must be implemented in the Tester class, and must be called in the main function.
. Every test function returns true or false to indicate the pass or fail.
.
A dump() function is provided for debugging purposes, visual inspections will not be accepted as
test cases.
You must write and submit a test program along with the implementation of the Art class. To test your
Art class, you implement your test functions in the Tester class. The Tester class resides in your test file.
You name your test file mytest.cpp. It is strongly recommended that you read the testing guidelines
before writing test cases. A sample test program including Tester class, and sample test functions are
provided in driver.cpp. You add your Tester class, test functions and test cases to mytest.cpp. You must
write a separate function for every test case.
Any program should be adequately tested. Adequate testing includes testing the functionaly for
normal cases, edge cases and error cases. The following list presents some examples:
Expert Solution
Check MarkThis question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
bartleby
Step by stepSolved in 2 steps
Knowledge Booster
Background pattern image
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
- In C++ Write a class, named "TwoOrLess" with a header file (two_or_less.hpp) and an implementation file (two_or_less.cpp). This is a class that acts much like a set, except it can hold 0, 1, or 2 duplicates of an int. You need to support the insert, count, and size methods with the same parameters and return types as the set<int> class (see test cases).arrow_forwardA list of projects and a list of dependencies, or a list of project pairings where the second project depends on the first project, are provided to you. Before starting a project, all of its dependencies must be built. Find a build order that enables the construction of the projects. Return an error if there is no proper construction order. EXAMPLEInput:projects: a, b, c, d, e, fdependencies: (a, d), (f, b), (b, d), (f, a), (d, c)Output: f, e, a, b, d, carrow_forwardWritten in Python It should have an init method that takes two values and uses them to initialize the data members. It should have a get_age method. Docstrings for modules, functions, classes, and methodsarrow_forward
- in visual c# (windows form app) no console or Console.WriteLine Design a non-static method that can be contained within an... Design a non-static method that can be contained within an instance/object of the MyCallback delegate type. This method should display values of two data fields contained within the object that is passed to the method. Make-up your own method definition that meets these requirements.arrow_forwardNo written by hand solutionarrow_forwardJava programming This problem set will test your knowledge of System I/O, and variable assignment. Your task is to create several different java classes (.java files) that will produce a specific output based on the user input. All input will be given to you either as a command-line argument or typed in from the keyboard. Below you will find directions for each class you need to create. Please make sure that the class name and java file name match the name 1, ContainsAnyCase This program will accept two user inputted values that are strings. The first user input will be a single word the second user input will be a sentence of random words. This program should print "true" if the first word is in the sentence of words regardless of the casing. In other words case is ignored when checking if the word is within the sentence. The last string that this program should print is "true" or "false", nothing else. 2 PrintMathResult Write an application that will wait for three user inputted...arrow_forward
- This "Math Skill Builder" programming project will assess a few basic mathematics skills and includes a simple programmed interface to generate three Math skill builder problem sets in the area of arithmetic, geometry and statistics. Although the interface includes statistics, the problem sets are not generated and maybe used for an extra credit portion of this project. The program interface for each Math skill builder set generates four problems in a series that make up the set and uses randomly generated numbers in the range of 1 to 10, stored as double values.arrow_forwardExpected Output: A) Success Case: B) Failure Case: Enter details of 1 Employee Enter Employee Id : 11 Enter details of 1 Employee Enter Employee Id : 101 Enter Employee Name : John Mathew Enter Enployee Name : KS Enter Employee Age : 23 Enter Enployee Age : 34 Enter Employee Salary : 6787.89 Enter Employee Salary : 2345.6 Enter details of 2 Enployee Enter Employee Id : 201 Enter details of 2 Employee Enter Enployee Id : 12 Enter Employee Name : Harry Bajwa Enter Employee Age : 34 Enter Enployee Name : WR Enter Employee Salary : 8765.43 Enter details of 3 Employee Enter Employee Id : 301 Enter Enployee Age : 35 Enter Employee Salary : 5678.99 Enter Employee Name : Sana Murshid Enter details of 3 Employee Enter Enployee Id : 13 Enter Employee Age : 25 Enter Employee Salary : 6784.34 Details of Employees (Original Data) Id Enter Employee Name : RT Name Age Salary Enter Enployee Age : 45 101 201 301 John Mathew 23 6787.89 Наггy Bajна Sana Murshid 34 8765.43 Enter Enployee Salary : 8974.35...arrow_forwardIn C++ Please: The class and functions need to be on an .h file while the main needs to be small and on a seperate .cpp file. Create a class AccessPoint with the following attributes: x - a double representing the x coordinate y - a double representing the y coordinate range - an integer representing the coverage radius status - On or Off Add constructors. The default constructor should create an access point object at position (0.0, 0.0), coverage radius 0, and Off. Add accessor and mutator functions: getX, getY, getRange, getStatus, setX, setY, setRange and setStatus. Also, add a set function that sets the location coordinates and the range. Add the following member functions: move and coverageArea. Add a function overlap that checks if two access points overlap their coverage and returns true if they overlap. Add a function signalStrength that returns the wireless signal strength as a percentage. The signal strength decreases as one moves away from the access point location. Test...arrow_forward
- You are given a list of projects and a list of dependencies (which is a list of pairs ofprojects, where the second project is dependent on the first project). All of a project's dependencies must be built before the project is. Find a build order that will allow the projects to be built. If there is no valid build order, return an error.EXAMPLEInput:projects: a, b, c, d, e, fdependencies: (a, d), (f, b), (b, d), (f, a), (d, c)Output: f, e, a, b, d, carrow_forwardYou are to use the started code provided with QUEUE Container Adapter methods and provide the implementation of a requested functionality outlined below. The program has to be in c++, and have to use the already started code below. Scenario: A local restaurant has hired you to develop an application that will manage customer orders. Each order will be put in the queue and will be called on a first come first served bases. Develop the menu driven application with the following menu items: Add order Next order Previous order Delete order Order Size View order list View current order Order management will be resolved by utilization of an STL-queue container’s functionalities and use of the following Queue container adapter functions: enQueue: Adds the order in the queue DeQueue: Deletes the order from the queue Peek: Returns the order that is top in the queue without removing it IsEmpty: checks do we have any orders in the queue Size: returns the number of orders that are in...arrow_forwardIn this assignment, you will implement the shell "engine" as the "group" component, where all members are responsible for the following functionality: • A Command-Line Interpreter, or Shell Your shell should read the line from standard input (i.e., interactive mode) or a file (i.e., batch mode), parse the line with command and arguments, execute the command with arguments, and then prompt for more input (i.e., the shell prompt) when it has finished. 1. Interactive Mode In interactive mode, you will display a prompt (any string of your choosing) and the user of the shell will type in a command at the prompt.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
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