Click here to Skip to main content
15,889,462 members
Please Sign up or sign in to vote.
1.00/5 (5 votes)
See more:
Consider the given below class code. Assume all header files are included.
C++
//////////////////////////////////dna.h//////////////////////////////////////////////////////////////////////
class DNA
{
private:
string sequence;
public:
DNA();
void get_data();
void print();
};

C++
//////////////////////////////////dna.cpp///////////////////////////////////////////////////////////////////////////
DNA::DNA( )
{
sequence = " ";
}
void DNA::get_data( )
{
cout<<"\n Entering DNA Sequence";
cout<<"\n Enter DNA Sequence Characters";
cin>>sequence;
}
void DNA::print( )
{
cout<<"\n\n PRINTING DNA SEQUENCE";
cout<<"\n DNA Sequence = "<<sequence;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Q1. Write code segments in IDE (netbeans or any other), paste its screenshot. There should
be no error in the code.
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.

What I have tried:

please answer my qoueston as soon as possible no this is not a homework plaease help me pleaseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
Posted
Updated 21-Jan-21 3:23am
v4
Comments
Patrice T 21-Jan-21 6:16am    
You asked no question; you just pasted your homework.
Member 15052206 21-Jan-21 7:39am    
nooo
please this is not a homewrk
Richard MacCutchan 21-Jan-21 7:46am    
But it is still your work, so you need to make the effort to do it.
Member 15052206 21-Jan-21 8:25am    
please try to unerstand i have no time to doo please help dear please for kind sake please
Richard MacCutchan 21-Jan-21 8:29am    
If you have no time to do your own work then you may like to consider a change of career. Please note this site does not provide code to order.

Did you try, at least, to perform step Q1?

You requirements look poor, to me.
Quote:
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.
Constructor cannot return a value. It may just throw.


Quote:
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.
You cannot create two constructor overloads having the same signature.
 
Share this answer
 
You need to Learn C++ to solve the problem. It isnt to hard, but you need to understand EACH point of your task clearly. So g) und h) are a bit advanced, so consider starting with a). Like in a) you must check every character of the input string that it matches the pattern. Maybe you ask your class fellows or teacher for some details.

If your teacher is a bit smart, than he will ask you to explain the code. That will be the moment of truth for your coding skills.
 
Share this answer
 
Comments
Richard MacCutchan 21-Jan-21 9:28am    
"If your teacher is a bit smart"
Not judging by the question.
KarstenK 22-Jan-21 5:09am    
the teacher may be also be more clever by NOT asking to much avoid discrimation issue. (that is reality in germany)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900