C++ hw7 | Computer Science homework help

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 SequenceClass:  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 GeneClass:  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)

 

  1. 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.

 

  1. Create the implementation file Gene.cpp and a tester file named GeneTester.cpp.
    1. Add a single function implementation at a time.

                                                               i.      Constructor

                                                             ii.      aCount(), cCount(), tCount(), and gCount()

                                                           iii.      Destrutor

    1. 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.

 

Calculate the price of your order

Choose an academic level, add pages, and the paper type you want.
To reduce the cost of our essay writing services, select the lengthier deadline.
We can't believe we just said that to you.

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more

Why is Purdue Papers the Most Helpful Essay Writing Service for You?

  1. Custom-written and plagiarism-free papers: Our authors create their work from scratch. Before presenting them to clients, we routinely verify them for signs of plagiarism. Our quality assurance group also double-checks and fixes any grammatical errors, assuring that all of our authors adhere to the same standards of writing.
  2. The significance of timely delivery cannot be overstated, and we consistently strive to meet or exceed our clients' deadlines. Regardless of the short time frame, you can count on our writers to get the job done. We always have a team of writers ready to go, even if the deadline is only six hours away.
  3. Customer Satisfaction: Our customer service representatives are the best in the business and have a wealth of knowledge in dealing with clients. All our customer service representatives are trained to listen and reply promptly until you are satisfied with their service. To ensure you're happy, our expert writers will strictly follow the criteria to generate a special report. Our customer service may be contacted by chat, email, or phone. In addition, we provide round-the-clock assistance to all of our clients.
  4. Confidentiality: Our systems are safe, and your information is always protected. We're constantly looking for new facts when it comes to finishing your work. We use a safe and secure payment channel. Since our ordering process is completely anonymous, you don't have to provide any credit card information to place a purchase with us.
  5. Highly Trained Authors: Our writers have received extensive training and are committed to delivering only the best papers. They are fluent in APA, MLA, HARVARD, IEEE, CHICAGO, and AMA referencing styles. To meet your expectations, our skilled writers always pay close attention to your instructions.
  6. Lowered prices: We have set prices that are already discounted. Our prices are the best and affordable for all our esteemed customers.

Let Professionals Take Care of your Academic Paper