Question: C++ LAANGUAGE QUESTIN ----------------------------------------------------------------------------------------------------------------------------------------------- Q1. Write code segments in IDE (netbeans or any other), paste its screenshot. There should be no error in the code.
C++ LAANGUAGE QUESTIN
-----------------------------------------------------------------------------------------------------------------------------------------------
Q1. Write code segments in IDE (netbeans or any other), paste its screenshot. There should be no error in the code. (05 pts each) a. Overload the constructor with one string parameter in such a way that the DNA sequence will not be NULL, it will be the sequence passed in the function. The function will only create the DNA sequence if it is containing the bases A,T,C,G and gaps -. If it is not so, the function will print the error message that due to invalid bases, DNA sequence cannot be created. b. Overload the constructor with one string parameter in such a way that the DNA sequence will not be NULL, it will be the sequence passed in the function as a parameter. Also the function will print here the DNA Sequence entered. c. Create a function that will return the count of nucleotides in the DNA sequence entered. d. Create a function that will convert the DNA sequence entered into upper case and return the converted sequence. e. Create a function that will return the RNA sequence created from the DNA sequence. f. Create a function that will print the count of all the bases present in the DNA sequence as well as the gaps. g. Overload the print( ) function that will return the DNA Sequence rather than printing it from the function. h. Create a copy constructor.
-----------------------------------------------------------------------------------------------------------------------
class DNA { private: string sequence; public: DNA(); void get_data(); void print(); };
//////////////////////////////////dna.cpp/////////////////////////////////////////////////////////////////////////// DNA::DNA( ) { sequence = " "; } void DNA::get_data( ) { cout<<" Entering DNA Sequence"; cout<<" Enter DNA Sequence Characters"; cin>>sequence; } void DNA::print( ) { cout<<" PRINTING DNA SEQUENCE"; cout<<" DNA Sequence = "< -------------------------------------------------------------------------------------------------------------------------------------- Q2. Create a main program based on the DNA class and all the functions created above according to the following requirements. Write the code in IDE (netbeans or any other), paste its screenshot. There should be no error in the code. a. Create a pointer of string type and assign it to DNA object and print it. (03 pts) b. Create a DNA pointer object using parametrized constructor and print it. (03 pts) c. Create a vector of type DNA. Insert 03 DNA objects in vector using push_back(). Also print the complete vector. (03 pts) d. Can you create a pointer type DNA vector. Justify your answer. (01 pts) e. Give call to all the functions (that have been created in Q1.) using a simple DNA object and give output. (05 pts) f. Give call to all the functions (that have been created in Q1) using the DNA pointer object created in Q2. (b). and give output. --------------------------------------------------------------------------------------------------------------------------------------------------------
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
