CMIS 102 Week 3 Hands On Lab
Just Click on Below Link To Download This Course:
http://bit.ly/2NhTneW
CMIS 102 Week 3 Hands On Lab
Overview
This hands-on lab allows you to follow and experiment with the critical steps
of developing a program including the program description, analysis, test plan,
design, pseudocode visualization, and implementation with C code. The example
provided uses mathematical operators and variable types. Program
Description
This program will calculate the area of a right triangle. The program will ask
the user to enter the base and height and then use these values to calculate
and then print the area of the triangle. The design step will include
pseudocode.
Analysis
I will use sequential programming statements. I will define two float numbers
for the base and height: base, height. Float numbers were selected as opposed
to integers to make sure triangles of all dimensions are possible and not just
whole numbers.
Float number
will store the area: area
The area will be calculated by this formula:
Area = ½ * (base * height)
For example
if the base was 4.2 and the height was 5.3 the area would be calculated as:
Area = ½ * (4.2 * 5.3) = ½ * (22.26) = 11.13
Test
Plan
To verify this program is working properly the following base and height values
could be used for testing:
|
TEST case |
Input |
Expected output |
|
1 |
Base=10.1
Height = 12.2 |
Area
= 61.61 |
|
2 |
Base=2.67
Height = 3.23 |
Area
= 4.31 |
|
3 |
Base=100.0
Height = 400.0 |
Area
=20000.0 |
Pseudocode
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
C
Code
The following is the C Code that will compile in execute in the online
compilers.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
Learning Exercises to be complete (Setting up the code
and the input parameters in ideone.com:)
- Change the C code to calculate the perimeter of a triangle. Support
your experimentation with a screen capture of executing the new code
- Prepare a new test table with at least 3 distinct test cases
listing input and expected output for the perimeter of a triangle.
- What is this line of code doing?
|
1 |
|
4.
How would you change this line if you wanted
to input an Integer as opposed to a float?
- What are the values of f and g after executing the
following C?
|
1 2 3 4 5 6 7 8 9 10 11 12 |
|
6.
Describe specifically, and in your own words,
why are the values of f and g different? Support your experimentation with a
screen capture of executing the code.
Submission
Submit a neatly organized word (or PDF) document that demonstrates you
successfully executed this lab on your machine using an online compiler. You
should provide a screen capture of the resulting output.
Also, provide the answers, associated screen captures, C
Code and descriptions of your successful completion of learning exercises 1, 2,
3 and 4.
The answers to the learning exercises, screen captures, C
code and descriptions can be included in the same neatly organized document you
prepared as you ran this lab. Note the code can be embedded in the word
document. However; be sure all code compiles and runs perfectly before
submitting the document.
Submit your
document no later than the due date listed in the syllabus or calendar.


Comments
Post a Comment