Introduction;We have discussed ?inheritance?, one of the fundamental concepts of Object Oriented Programming (OOP). In this homework we will experience inheritance concept through C++ programming to reinforce what we have learned in class. We will extend Sequence class to create Gene class. We also create a driver program to test each function in Gene class.;Instructions: Download starter code from Learn@UW-Stout under Content (Homework). Then implement Gene.h and Gene.cpp and create a tester program.;In the Visual Studio project, there are three files;? Sequence.h: Sequence class hearder file ? no change required;? Sequence.cpp: Sequence class implementation file ? no change required;? GeneTest.cpp: a driver program that tests Gene class implementation;Sequence;- sequence: char*;- length: int;+ Sequence(string s);+Sequence(const Sequence& s) //Copy constructor;+Sequence& operator=(const Sequence& s) //Assignment operator;+void set(int index, char c) //Set character at index to value in c;+ ~Sequence();+ getSequence() const:char*;+ size() const:int;Friend functions;+ bool operator==(const Sequence& lhs, const Sequence&rhs);+ostream& operator<< (ostream&ostr, constSequence&g);+ bool operator<(const Sequence& lhs, const Sequence&rhs);Gene;+ Gene(string s);+Gene(const Gene& g)//Copy constructor;+Gene& operator=(const Gene& g) //Assignment operator;+ ~Gene();+ aCount() const:int;+ cCount() const:int;+ tCount() const:int;+ gCount()const:int;For this assignment you will design a C++ class to store information about a Gene using the existing Sequence class. Starter code includes sequence class declaration (Sequence.h) and member function implementation (Sequence.cpp).;The Sequence Class: This class simulatesa sequence in biology.;Data Members;Array of characters for each element in the sequence. Each element is represented by a character. The array is allocated during object construction.;length to represent the number of elements in the Sequence.;Member Functions;Constructor that takes in a string object representing the Sequence.;A string object in C++ has the following useful methods;size();[index] that returns the character at each index.;Initialize the data members using this input by determining the size of input string and then creating and filling sequence.;Destructor to deallocate memory allocated by the constructor (Do last);Copy Constructor;Assignment operator=;set(): void sets character at index to value in c.;getSequence():char* returns a pointer to the start of the sequence array.;size():int returns the number of elements in the sequence (chars);Friend Functions;Operator== that returns true if the Sequences have the same size and exactly the same sequence. Note that an equal sequence could be listed in reverse order.;Operator<< to output the sequence with up to 40 characters per line.;Operator< checks to see if the sequence on the left hand side is a subsequence of the right hand sequence. The entire subsequence must be found in the right hand sequence to be true otherwise return false. Note again that the reverse of the subsequence may be contained in the sequence.;The Gene Class: This class should simulate a gene in biology.;Member Functions;Constructor that takes in a string object representing the Gene.;Use the string to call the Sequence constructor;Copy Constructor (also in Sequence);Assignment operator operator= (also in Sequence);Destructor to deallocate memory used on the heap.;aCount():int returns the count of nucleotides in gene represented by a.;cCount():int returns the count of nucleotides in gene represented by c.;tCount():int returns the count of nucleotides in gene represented by t.;gCount():int returns the count of nucleotides in gene represented by g.;Must have exact method header in code as in the UML so that a different tester file can be used to grade the assignment.;Task #1 Coding the UML Diagrams (20 points);Create the header file Gene.h including all functions and data members. It will inherit from Sequence. You must use the exact names described in the UML diagram. I will provide a test file to test your code and calculate the grade.;Create the implementation file Gene.cpp and a tester file named GeneTester.cpp.;Add a single function implementation at a time.;i. Constructor;ii. aCount(), cCount(), tCount(), and gCount();iii. Destrutor;After each file is implemented create an object in the main method of GeneTester to test the implementation. Be sure to test all aspects of each function thinking about boundary cases.;3. After each file is implemented create an object in the main method of GeneTest to test the implementation. Be sure to test all aspects of each function.;Task #2 Testing;I will provide tester program to be downloaded from D2L. It will test your code to see that the implementations are correct. You will need to replace this tester program with yours.;Submission note: You do NOT NEED TO SUBMIT ANYTHING TO THE DROPBOX! Instead, you will need to show your programs for your answers to the instructor or SIs during class.
Paper#69113 | Written in 18-Jul-2015Price : $37