Assignment 1 Practice Questions - Computer Programming | CPS 196, Assignments of Computer Science

Material Type: Assignment; Class: Introduction to Computer Programming; Subject: Computational Science; University: Syracuse University; Term: Fall 2007;

Typology: Assignments

Pre 2010

Uploaded on 08/09/2009

koofers-user-b9k
koofers-user-b9k 🇺🇸

7 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CPS 196
Homework Assignment 1 Due Wednesday, September 19, 2007, at midnight.
Revised September 13 – only one program to analyze and write.
While you may discuss this assignment with others, all work you submit must be your
own. That means, after discussing it, you must go back and write it up yourself.
Here are the steps of the Software Development Process as discussed in lab:
Software Development Process:
Part I:
1. Specify the problem requirements:
Restate the problem.
If any additional information is needed, get it and list it here.
If assumptions are made, list them.
2. Analyze the problem:
List the inputs, determine their data types and pick variable names for them.
List the outputs, determine their data types and pick variable names for them.
Give an example of the complete dialog with input and output values.
Give any formulas needed.
Work out one example in detail. Show the step by step calculations. If you need
any additional variables, identify their type and name them.
3. Design the algorithm to solve the problem by listing the steps. These simple
algorithms in class so far have the same basic steps:
Obtain the data.
Do the calculations.
Give the output.
Part II:
4. Write a C program, using the analysis above for comments:
a) The program should be well documented and have good variable names.
b) Turn the inputs and outputs of part 2 and the additional variables identified
in part 3, into declarations.
c) Take the steps from your algorithm in part 3, put them into your program
as comments, then fill out the C code below each comment.
d) Test your program thoroughly using the test values from part 3 and check
your results.
Follow the above steps to write C programs for two problems:
Program 1: Write a program that can convert a measurement expressed in centimeters to
one that gives the measurement in feet and inches. (You may want to know this formula
for converting centimeters to inches: inches = 0.39 * cms.)
pf2

Partial preview of the text

Download Assignment 1 Practice Questions - Computer Programming | CPS 196 and more Assignments Computer Science in PDF only on Docsity!

CPS 196

Homework Assignment 1 Due Wednesday, September 19, 2007, at midnight. Revised September 13 – only one program to analyze and write.

While you may discuss this assignment with others, all work you submit must be your own. That means, after discussing it, you must go back and write it up yourself.

Here are the steps of the Software Development Process as discussed in lab:

Software Development Process:

Part I:

  1. Specify the problem requirements: Restate the problem. If any additional information is needed, get it and list it here. If assumptions are made, list them.
  2. Analyze the problem: List the inputs, determine their data types and pick variable names for them. List the outputs, determine their data types and pick variable names for them. Give an example of the complete dialog with input and output values. Give any formulas needed. Work out one example in detail. Show the step by step calculations. If you need any additional variables, identify their type and name them.
  3. Design the algorithm to solve the problem by listing the steps. These simple algorithms in class so far have the same basic steps: Obtain the data. Do the calculations. Give the output.

Part II:

  1. Write a C program, using the analysis above for comments: a) The program should be well documented and have good variable names. b) Turn the inputs and outputs of part 2 and the additional variables identified in part 3, into declarations. c) Take the steps from your algorithm in part 3, put them into your program as comments, then fill out the C code below each comment. d) Test your program thoroughly using the test values from part 3 and check your results.

Follow the above steps to write C programs for two problems:

Program 1: Write a program that can convert a measurement expressed in centimeters to one that gives the measurement in feet and inches. (You may want to know this formula for converting centimeters to inches: inches = 0.39 * cms.)

Program 2: This program is removed from the homework assignment. Only hand in the analysis, program and output from Program 1.

What to hand in:

Each program must have: a) One txt, rtf or word document with all of Part I of the development process. b) The .c file with the C program (do not hand in the project or solution files). c) One text file, with sample runs that you copied and pasted from the Console window. These should include the test runs described in part 3.

All of these should be zipped together and submitted as ONE zip file, called hw1.zip. Check the assignment page for instructions to zip files. Submit the zipped file through blackboard.