CPE 101 Project 1
- To demonstrate your mastery of writing sequential programs with
input, calculations, and output.
- To demonstrate your mastery of editing, compiling, and executing
C programs on Unix.
- Your instructor or the designated department tutors in the
- Your textbook(s)
- Your own innate capabilities and resourcefulness!
- A working program exhibiting the correct behavior that you can
run on Unix1 by typing the command:
- Your program must use only language
features from Chapter 2.
- Your program must mimic the sample
program's behavior exactly and in all cases (see Resources
section above on how to run the sample program).
- NOTE: This project is to be an
individual effort! DO NOT
collaborate with any of your classmates -- or anyone else on this
project. Violating this rule may result in being failed from the
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.
The purpose of your program is to compute the difference in molecular
weight of any two amino acids, given their molecular composition.
The number of atoms of each of the five elements above contained in two
amino acids (a whole number).
The molecular weight of each amino acid.
The difference between the two weights.
Format all numbers to two decimal places. (Use a placeholder
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.
Input data will contain no characters.
Input data will contain only positive numbers.
Only integer values will be entered for integer variables.
Values entered by the user are underlined.
For the first amino acid, enter the number of atoms of
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,
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
|Correct input and output message format
||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.
- You will submit a single source code file named project1.c.
name is included in the header comment at the top of the
- 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.
- Submit your code using handin:
handin graderjd Project1 project1.c
- 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
- Late submissions (even by one second) receive no credit.