CPE 101 Project 1

Objectives

Resources

Ground Rules

1.0 Overview

Molecular Weights of Amino Acids

Amino acids are composed of atoms of oxygen, carbon, nitrogen, sulfur, and hydrogen, whose atomic weights are given in the table below.

Element Atomic Weight
Oxygen 15.9994
Carbon
12.011
Nitrogen
14.00674
Sulfur
32.066
Hydrogen
1.00794

The purpose of your program is to compute the difference in molecular weight of any two amino acids, given their molecular composition.

2.0 INPUT REQUIREMENTS

The number of atoms of each of the five elements above contained in two amino acids (a whole number).

3.0 OUTPUT REQUIREMENTS

The molecular weight of each amino acid.
The difference between the two weights.
Format all numbers to two decimal places. (Use a placeholder of %.2f).

4.0 FUNCTIONAL REQUIREMENTS

4.1. Obtain the number of atoms of each of the five elements above contained in two amino acids.
4.2  Calculate the molecular weight for each amino acid. Multiply the number of atoms input for each element by the atomic weight in the table above, and compute the total.
4.3  Display the molecular weight for each amino acid.
4.4  Display the difference (first minus second).

5.0 IMPLEMENTATION CONSTRAINT
5.1 The atomic weights must be coded as constants.

ASSUMPTIONS
Input data will contain no characters.
Input data will contain only positive numbers.
Only integer values will be entered for integer variables.

SAMPLE EXECUTION
Values entered by the user are underlined.

For the first amino acid, enter the number of atoms of cargon, hydrogen,
nitrogen, oxygen, and sulfur (in that order): 6 13 1 2 0
The molecular weight of the first amino acid is 131.17
For the second amino acid, enter the number of atoms of cargon, hydrogen,
nitrogen, oxygen, and sulfur (in that order): 4 9 1 3 0
The molecular weight of the second amino acid is 119.12
The difference in weights is 12.05



7.0 Grading

40%
Correct computations
20%
Correct input and output message format
15% Algorithm design
15% Conformance to coding standard.
10% Clean compile (no warnings using the required compiler flags).

Remember, your program will be tested on Unix1.  Code that compiles with errors will receive a grade of zero.

8.0 Submitting Your Work

You need to submit your source code electronically using the   handin   utility. Work submitted late, even by one second, receives no credit.

  1. You will submit a single source code file named project1.c. Make sure your name is included in the header comment at the top of the file.
  2. Be sure to compile and test your code on Unix1 using the required compiler flags ( -Wall -ansi -pedantic) one last time just before turning the files in.
  3. Submit your code using handin:
    handin graderjd Project1 project1.c

  4. You should see a message that indicates handin occurred without error. You can (and should) always verify what has been handed in by executing the following command:
    handin graderjd Project1
  5. Late submissions (even by one second) receive no credit.