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...
Write a C++ program for the following problem: Calculate and print the area and volume of...
Write a C++ program for the following problem: Calculate and print the area and volume of a cone inside a While  loop that goes from 1 to 20 with a step of .5. (the step is 1/2 or Point 5, so you go 10, 10.5,11, 11.5) Note: Your loop variable will need to be a double data type Use two decimal places on all numbers that are double data type. This will be a table with 3 columns. Don't worry about...
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
Write a C++ program to print all the perfect numbers below a certain given number. A...
Write a C++ program to print all the perfect numbers below a certain given number. A perfect number is a number that that is equal too the sum of it's divisors other than itself . For example, 6 and 28 are all perfect numbers. 6 = ( 1+2 +3) 28 = (1+2+4+7+14) Make sure your program conforms to the following requirements: 1. Accept the upper limit from the user (as an integer). 2. Make sure the number is positive (at...
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
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
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT