Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design and code a class named ProteinDatabase that manages a dynamically allocated array of elements of type std::string. Your class keeps track of the number

Design and code a class named ProteinDatabase that manages a dynamically allocated array of elements of type std::string. Your class keeps track of the number of strings currently stored and defines the following member functions:

  • a no-argument default constructor
  • a 1-argument constructor that receives as parameter a string containing the name of a file from which this member function populates the current object. This function
    1. reads the file to count the number of protein sequence present in the file.

      In the file, each protein sequence is prefixed by a line starting with a greater than character (">") followed by a description of the origin of the sequence of no more than 131 characters.

      The protein sequence will begin on the next line for some number of lines. Each line (except the last one) will contain exactly 80 characters.

    2. allocates memory for that number of protein sequences in the array

    3. re-reads the file and loads the protein sequences (i.e., string of characters not sequence names) into the array.

  • size_t size(): a query that returns the number of protein sequences stored in the current object.
  • std::string operator[](size_t): a query that returns a copy of the protein sequence at the index received as the function parameter. If the index is invalid, this function should return an empty string.
  • Upgrade the ProteinDatabase class to include a move constructor and a move assignment operator

please respond as soon as possible!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions

Question

6. Do you currently have a team agreement?

Answered: 1 week ago

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago