Due: Monday, Jan 29, 3 pm.
50 points
Write a program to calculate distance traveled at a user-specified rate and time and also the vertical distance covered given a user-specified slope.The first two sections of the lecture notes and the first two chapters of your text contain information and examples to help with this.
Include a comment section at the top of your C++ source code patterned after the following:
/************************************************************************
CSCI 240 Assignment 1 - Spring 2007
Programmer: your name
Z-ID: Znnnnnn
Section: your recitation section number
GA: your TA's name (see Course Web site)
Date Due: 01/29/07
Purpose: This program prompts the user to ...
************************************************************************/
You may recall that there are 5280 feet in a mile.
You will need to:
Use
- #include <iostream>
- using namespace std;
- floating point "double" variables for all numeric values
- cin to get the input values
- do not worry about the number of decimal places displayed
- return 0
A single run should closely resemble the following:
Enter the speed in miles per hour: 3.8 Enter the time in seconds: 600 Enter the slope as a percent (e.g. 6): 6 The total distance traveled: .633333 miles Vertical distance traveled: 200.639 feet
These results come from:
3.8 mph times 1/6 (600/3600) of an hour = number of miles
.633 miles times 6% = number of vertical miles. That times 5280 = number of
feet
Hand in a printed copy of your source code in the drop box in the CS lab.
Submit an electronic copy. Instructions are
here.
If you do not follow these instructions, you will get a score of 0 for the assignment until you do supply all the pieces required.