CS 010 - Introduction to Computer Science I
Assignment 5:

DUE: Monday, 8/16 before 11:00pm


Collaboration Policy

Collaboration is strongly ENCOURAGED. You will be working in teams, but programs must represent YOUR OWN original work. Teams should work on the algorithm together and help debug/test each others code. However, copying code from ANY source (any book, current or past students, past solutions, the web, etc.) is STRICTLY FORBIDDEN. Code between teamates will be similar, but you are not allowed to just copy a teamate's solution.


Code that is turned in, must be contained in a .cpp file named main.cpp. Files of any other format will not be graded (e.g. main.doc, main.txt, etc…).

You must turn your work in from a lab computer on campus.

Turn in online to as5 folder. If you turn your assignment in to the wrong folder, your assignment may not be graded. If it is graded, you will lose 2 pts (out of 10).

Remember to include the following header information at the top of your program;

// last name, first name
// last 4 digits of SID
// UCR email address
// user name (log in name)


Problem Definition:

    For this assignment you will write a some functions that return values to be used in ccc_win_main.  The values returned will be used in a control algorithm.  The control algorithm simulates a body falling under the force of gravity, and with the capability to produce upward "thrust" through a rocket engine.  All of the code needed to impliment the control algorithm--including animation--has been written, and is contained in the file below, you will need this to get started.  However, the code will not compile as is, you will need to write three function definitions;  a function that returns a new position based on the current position, velocity, acceleration, and time,  a function that returns a new velocity based on the current velocity, acceleration, and time, and a function that returns an acceleration value based on the users input.  To calculate the position you will use the equation given in assignment one, to calculate the velocity you will use the equation: v_final = v_current + acceleration * t.  Note that on line 94 in the start code is where the functions are actually called, this will help give you an idea of what the functions are doing.  It is also important that you go through the code and come to understand it, as you will have to modify the main function for the next programming assignment.
    When working on this program do NOT alter the ccc_win_main function in any way, if you alter this code you will receive an automatic zero for this assignment.  You are only required to write the function header, and body for each of the three functions.

Starting Code
main.cpp

Example Program Download
main


Rubric: (10 pts total)

1 pt: Correct function header for position function
1 pt: Correct function
header for velocity function
1 pt: Correct function header for acceleration function
1 pt: Position function returns correct value
1 pt: Velocity function returns correct value
1 pt: Acceleration function returns correct value
2 pts: Variable parameters are correctly passed by value to functions

2 pts: Style (0.5 each)
       - Good variable names
       - Proper indentation
       - Good comments
       - No line wraps