Question

In: Computer Science

construct a c++ program that calculate/print the molecular weight of the below five amino acids Oxygen:...

construct a c++ program that calculate/print the molecular weight of the below five amino acids

Oxygen: 15.9994

Carbon: 12.011

Nitrogen: 14.00674

Sulfur: 32.066

Hydrogen: 1.00794

The program should prompt the user to enter the number of each one of the atoms and then print/compute the molecular weight.

Solutions

Expert Solution

Here is the completed code for this problem. Comments are included, go through it, learn how things work and let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please rate the answer. Thanks

#include<iostream>

using namespace std;

//declaring constants for storing atomic masses of all 5 elements

const double ATOMIC_MASS_OXYGEN=15.9994;

const double ATOMIC_MASS_CARBON=12.011;

const double ATOMIC_MASS_NITROGEN=14.00674;

const double ATOMIC_MASS_SULFUR=32.066;

const double ATOMIC_MASS_HYDROGEN=1.00794;

int main(){

                //declaring variables

                int oxygen, carbon, nitrogen, sulfur, hydrogen;

               

                //asking and reading number of atoms of each element

                cout<<"Enter the number of Oxygen atoms: ";

                cin>>oxygen;

               

                cout<<"Enter the number of Carbon atoms: ";

                cin>>carbon;

               

                cout<<"Enter the number of Nitrogen atoms: ";

                cin>>nitrogen;

               

                cout<<"Enter the number of Sulfur atoms: ";

                cin>>sulfur;

               

                cout<<"Enter the number of Hydrogen atoms: ";

                cin>>hydrogen;

               

                //finding molecular weight by summing the product of number of atoms and atomic mass

                //of each element

                double molecular_weight=oxygen*ATOMIC_MASS_OXYGEN+

                                carbon*ATOMIC_MASS_CARBON+

                                nitrogen*ATOMIC_MASS_NITROGEN+

                                sulfur*ATOMIC_MASS_SULFUR+

                                hydrogen*ATOMIC_MASS_HYDROGEN;

               

                //displaying the result

                cout<<"Molecular weight of the compound: "<<molecular_weight<<endl;

                return 0;

}

/*OUTPUT*/

Enter the number of Oxygen atoms: 1

Enter the number of Carbon atoms: 1

Enter the number of Nitrogen atoms: 1

Enter the number of Sulfur atoms: 0

Enter the number of Hydrogen atoms: 3

Molecular weight of the compound: 45.041


Related Solutions

Below are the DNA sequences that encode the first eight amino acids for five alleles of...
Below are the DNA sequences that encode the first eight amino acids for five alleles of the Adh protein in Drosphila pseudoobscura. Nucleotides that differ from the first sequence are shown by a lowercase letter. ATGTCTCTCACCAACAAGAACGTC ATGgCTCTCACCAACAAGAACGTC ATGTCgCTCACCAACAAGAACGTC ATGTCTtTgACCAACAAGAACGTC ATGTCTCTCACCAACAAGAACGTg a. What are the first eight amino acids for each of these five DNA sequences? b. For each of the five polymorphic sites, indicate whether the site represents a synonymous or nonsynonymous polymorphism. c. The fourth sequence shown above has...
Calculate Mn & Mw, and the polydispersity index (PI) for the molecular weight data provided below...
Calculate Mn & Mw, and the polydispersity index (PI) for the molecular weight data provided below and graph. Repeat your calculations if the molecular weight data were changed by increasing the frequency (# of chains) of the following molecular weights by 500 for molecular weights of 600, 700, 800, 900, 1000, and 1100 and graph. Explain what happens to the PI and what this means in terms of molecular weight distribution. Input data and graph in Excel or similar graphing...
what is the best code to construct a C++ program that finds a five digit number;...
what is the best code to construct a C++ program that finds a five digit number; This number should reverses the order of its digits when multiplied by four. Also, how many five digits numbers are there in which the sum of the digits is even.
Calculate the change in free energy of NADH oxidation by molecular oxygen
Calculate the change in free energy of NADH oxidation by molecular oxygen
Java program to print all the powers of 2 below a certain number. Calculate sum, accept...
Java program to print all the powers of 2 below a certain number. Calculate sum, accept upper limit and make sure sum variable is long type.   Run- Enter the upper limit: 100 5 + 8 + 9 + 11 + 20 + 32 + 30 = 115
Cytochrome C has a relative molecular weight of 11,384 g/mol. Calculate the extinction coefficient of cytochrome...
Cytochrome C has a relative molecular weight of 11,384 g/mol. Calculate the extinction coefficient of cytochrome C at 405nm from 6.1 mg/mL. Absorbance = 3.045
Below are the DNA sequences that encode the first eight amino acids for four alleles of...
Below are the DNA sequences that encode the first eight amino acids for four alleles of the Adh protein in Drosophila melanogaster. Nucleotides that differ from the first sequence are shown by a lowercase letter. ATGTCTCTCACCAACAAGAACGTC ATGgCTCTCACCAACAAGAACGTC ATGTCgCTCACCAACAAGAACGTC ATGTCTtTgACCAACAAGAACGTC a. What are the first eight amino acids for each of these four DNA sequences? b. For each of the four polymorphic sites, indicate whether the site represents a synonymous or nonsynonymous polymorphism. c. Synonymous polymorphisms tend to be more common...
Below are the DNA sequences that encode the first eight amino acids for four alleles of...
Below are the DNA sequences that encode the first eight amino acids for four alleles of the Adh protein in Drosophila melanogaster. Nucleotides that differ from the first sequence are shown by a lowercase letter. ATGTCTCTCACCAACAAGAACGTC ATGgCTCTCACCAACAAGAACGTC ATGTCgCTCACCAACAAGAACGTC ATGTCTtTgACCAACAAGAACGTC a. What are the first eight amino acids for each of these four DNA sequences? b. For each of the four polymorphic sites, indicate whether the site represents a synonymous or nonsynonymous polymorphism. c. Synonymous polymorphisms tend to be more common...
write the chemical formulas, calculate the molecular masses and find the percent of oxygen in the...
write the chemical formulas, calculate the molecular masses and find the percent of oxygen in the following compounds: a.) compound containing sodium and phosphate: b.) Compound containing calcium and sulfate c.) Compound containing Ammonium and carbonate: d.) Compound containing barium and hydroxide: 2.) Calculate the number of molecules in 4.5 moles of Ca(ClO3)2. 3.) Calculate the mass of (NH4)2CO3 in 4.0 moles of (NH4)2CO3. 4.) Calculate the number of molecules in 7.3 g of calcium sulfate. 5) Calculate the empirical...
Weak interactions among amino acids that stabilize the tertiary structure of the protein include (list five):
Weak interactions among amino acids that stabilize the tertiary structure of the protein include (list five):
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT