Question: Can you rewrite the code and fix it thanks //This program asks the user to enter the number of atoms for an amino acid then

 Can you rewrite the code and fix it thanks //This program

Can you rewrite the code and fix it thanks

//This program asks the user to enter the number of atoms for an amino acid then computes and prints the molecular weight for the amino acid //Andrew Serrano, 2/7/10

#include #include #include using namespace std; int main() { //Define Variables double NumberOfOxygen, NumberOfCarbon, NumberOfNitrogen, NumberOfsulpher, NumberOfhydrogen, weight; const double O=15.9994; const double C=12.011; const double N=14.00674; const double S=32.066; const double H=1.00794; char name[10]; cout>name; //input data cout > NumberOfOxygen>> NumberOfCarbon>> NumberOfNitrogen>> NumberOfsulpher>> NumberOfhydrogen;

//calculate weight weight = (NumberOfOxygen*O)+(NumberOfCarbon*C)+(NumberOfNitrogen*N)+(NumberOfsulpher*S)+(NumberOfhydrogen*H);

//Print cout

return 0; }

HAND IN LABORATORY TASK: LAB #7 Amino Acid Molecular Weights ie Molecular weight is the combining of the atomic weights of the individual elements in a molecular! The amino acids in proteins are composed of atoms of oxygen, nitrogen, sulfur and hydrogen whose atomic weights (average of isotopes) are Oxygen (O) 15.9994; Carbon (C) 12.011; Nitrogen (N) 14.00674; Sulfur (S) 32.066 Hydrogen (H) 1.00794 in amu units (atomic mass units- originally based on weights relative to hydrogen now they use carbon REMEMBER ABTRACT ON THE TOP OF THE PROGRAM. Do it after you solve the math INPUTS: input amino acid name glycine (use a string variable), and all the number of the elements in the amino acid at a time, ON ONE LINE for the calculation, rather than 5 separate "cin" lines. Number of Atoms in glycine: O 2,C-2,N-1,S 0,H-5 Use Lots of comments. Use constants in the program for element weights. Set up prior to main(). Output use formats of Scientific and setw0, then output name of the acid, number of each elements in the amino acid and the final calculated molecular weight of the amino acid (sum of all atomic weights.) with appropriate wording so the user know what they got. Rerun it for Methionine O 2,C-5,N-1,S-1,H-11 HINT AND REMINDER: cin

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!