Documente Academic
Documente Profesional
Documente Cultură
ASSIGNMENT #1
The distance that car (undergoing constant acceleration) will travel is given by the
expression :
S Vot
1 2
at
2
where
S = distance traveled
Vo = initial velocity
t = time of travel
a = acceleration
Write a program that takes the following input from a data file called distInput.txt
Vo
t
a
-------------------10
5
7
15
5
6
20
5
5
25
5
4
30
10
3
35
10
2
40
10
1
With the input, calculate the value for the distance traveled and print the following output
to the screen.
Vo
t
a
S
-----------------------------10
5
7
15
5
6
xx
xx
xx
xx
xx
xx
Then, give a choice to the user to enter their own value for Vo, t and a. Calculate S for
the entered value.
Also have a statement for the user either to continue or to exit from the program.