UMBC CMSC104 CSEE

UMBC CMSC 104

CMSC104

Problem Solving and Computer Programming

Sections 0101, 0201 and 0601

 

Project

Due

Project 2 is worth 100 points and due at midnight, Saturday, 15 March.

Requirements

Create a file named 6789prj2.c (where 6789 is the last four of your SSN, using the editor of your choice. This program is to calculate the velocity and distance traveled by a grapefruit with no initial velocity, t seconds after being dropped from a building. The user will provide the time in seconds, which must be a positive value.

The formula for calculating distance is:

distance = 0.5 times GRAVITY * time squared (that is the number of seconds multiplied by the number of seconds) The formula for calculating velocity is: velocity = GRAVITY times time in seconds The value for GRAVITY is 9.81 [ gravitational aceleration (m/s^2) ]

When outputting the values, only print one place past the decimal point, by making your printf statement use the following:

printf("%.1f", someVariable );

Compiling

Compile the program with the following command: If you got an error and you probably did, simply go back into the editor and fix it. Then recompile, continuing until you get no warnings or errors.

Executing

Execute the program with the following command: ./a.out If everything worked correctly, you should get the messages giving the distance of the fall and the velocity.

One Sample Output

(User input is in green.)
burt[153]: a.out
Welcome.
Calculate the height from which a grapefruit feel given the number of seconds
that it was falling.

Input seconds: 10
  Time of fall = 10 seconds
  Distance of fall = 490.5 meters
  Velocity of the object = 98.1 m/s
Normal termination.
burt[108]:
  

Second Sample Output

burt[154]: a.out
Welcome.
Calculate the height from which a grapefruit feel given the number of seconds
that it was falling.

Input seconds: -1
Normal termination.
burt[107]: a.out
  
Notice that the UNIX prompt must be on the next line!

Turning in your homework

Once you have everything absolutely correct, you must use Blackboard to submit the project to the TA for grading. Do not email it to the instructor because you will lose points for not following instructions!

Grading

This project will be grade using the following scale:

Documentation 25 points
Correct Results25 points
Correct Sytle25 points
Other25 points

You will lose 5 points if you do not name the file correctly.
You will lose 5 points if you email the project instead of submitting it via Blackboard.
You will lose 5 points if the prompt is not on the next line.
You will lose 5 points if you do not include your section number.

Comments Required

        /*****************************************************/
        /* Program Header Block                              */
        /* Filename:       6789prj2.c                        */
        /* Name:           Ima Student                       */
        /* SSAN:           6789                              */
        /* Date:           13 March 2003                     */
        /* Course/section: CMSC-104/0101                     */
        /* Description:                                      */
        /*     Analysis:                                     */
        /*         Input:                                    */
        /*         Output:                                   */
        /*         Constraints:                              */
        /*         Formulas:                                 */
        /*         Assumptions:                              */
        /*     Design:                                       */
        /*         (Your psuedocode goes here.)              */
        /*                                                   */
        /* Notes:          (As needed.)                      */
        /*****************************************************/
        


UMBC | CSEE |