CS 010 - Introduction to Computer Science I
Assignment 1:

DUE: Fri, April 8 before 2:00pm


Collaboration Policy

Limited collaboration is OK. You may do the following while writing a programming assignment: discuss general solution ideas with your study group members or have members observe a run of your program, and offer their ideas on its behavior. You should *never* look at someone else's code for the assignment to figure out how to do your own program.  It is very hard to write your own unique solution once you have seen someone else's.  If you need someone to look at your code to give advice, you should see a TA or instructor.  Of course, copying code from ANY source (any book, current or past student, past solutions, or the web) is STRICTLY FORBIDDEN.


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 using electronic turnin as in lab1, from a lab computer on campus, TURNING IN FROM HOME WILL NOT WORK!

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

Remember to include the following header information at the top of your program;
// Course: CS 10
//
// Lecture Section: ... 001 or 002
// Lab Section: ... 021, 022, etc)
//
// Assignment #: ... assignment 2, 3, etc.
//
// Last Name: Enter your LAST (family) name here (eg, Doe)
// First Name: Enter your FIRST (given) name here (eg, John)
//
// ID Number: Enter your ID number here (eg, 860-00-0000)
// lab login id: Enter your cs10 login here (eg, jdoe)
//
// Email address: Enter your UCR email address here (eg, jdoe@cs.ucr.edu)
//
// =======================================================================



Problem Definition:

For this assignment you will write a program that asks the user for information about the initial (x,y) position, and (x,y) velocity of an object. Given this information, the program will then print out the (x,y) position of the object at 0, 1, 2, 3, and 4 seconds. You will use the following equation to compute the position over time:

x_pos = x_init + (x_vel * t) + 0.5 * (x_acc * t * t)

where "x_init" is the initial x position, "x_vel" is the initial velocity in the x direction, "x_acc" is the acceleration in the x direction, "t" is the time in seconds, and "x_pos" is the x position after "t" seconds. A similiar equation would be used to compute the y position over time. You can assume that the object is under freefall in earth's atmospere, so acceleration in the y direction is a constant -9.81, and acceleration in the x direction is a constant 0 (zero). In your program these accelerations should be declared as constant doubles, and "t" should be a variable int.

Lastly, you need to fill out the following form:
readme.txt

Download the form into the directory containing your main.cpp file, by right clicking the above link and selecting "Save Link Target As...".  Next, open the file using emacs the same way you open your main.cpp files.  Fill out the form, and save it.  When you use electronic turn in, the form will be turned in with all the other files in your as1 directory.

Example program run:

What is the initial x position? 34
What is the initial y position? 100

What is the initial x velocity? 1.3
What is the initial y velocity? 0

Position after 0 second(s) is (34, 100)
Position after 1 second(s) is (35.3, 95.095)
Position after 2 second(s) is (36.6, 80.38)
Position after 3 second(s) is (37.9, 55.855)
Position after 4 second(s) is (39.2, 21.52)


Rubric: (100 pts total)

20 pts: Correctly declare constants and variables
20 pts: Gets input
20 pts: Calculations use variables for time, position and velocity, but constants for acceleration
20 pts: Correct output
10 pts:  Readme file is filled out and turned in with main.cpp file
10 pts:  Compiles without errors
0 pts: Style
    - comments
    - line wraps
    - header info included at top
    - spacing
    - Indentation
    - Good constant/variable names
    - No magic numbers

Note that you will not lose points for style on this assignment, you will only receive warnings. In the future, points will be deducted for style. For coding style requirements see the following link:
http://www.cs.ucr.edu/cs10/cs10_05spr/requirements/coding_std.html