Docsity

Calculating Velocity Program Project | CSC 1253, Study notes of Computer Science

Toggle sidebar
bg1
An Equation of Motion CSc 1253: Programming Project # 1
Calculating The Final Velocity
Out: 1/26
Due: 2/4 by 11:50 PM
Learning Objectives
•writing a C++ program that does input and output
•using Math Library functions
Definition 1. Rectilinear motion is a continuous change of position of
a body so that every particle of the body follows a straight-line path.
The variable quantities in a uniformly accelerated rectilinear motion are time,
speed, distance covered and acceleration. Simple relations exist between
these quantities. These relations are expressed in terms of equations called
equations of motion. One such equation is
vf=q2as +v2
i(1)
where ais the acceleration, sis the distance covered, viis the initial velocity,
and vfis the final velocity.
Write a C++ program that prompts the user for the value of the accel-
eration in ft
s2, initial velocity in ft
s, and the distance covered in ft. Your
program should then compute and display the final velocity in ft
s. Your pro-
gram should also convert the final velocity to m
sand display this quantity.
1m
sis approximately equals to 3.281 f t
s. All numeric values in the output
should be displayed with five decimal places and the input and output MUST
be formatted as below. Name your source file linearmotion.cpp.
Duncan 1 Spring 2011
pf3

Partial preview of the text

Download Calculating Velocity Program Project | CSC 1253 and more Study notes Computer Science in PDF only on Docsity!

Calculating The Final Velocity

Out: 1/ Due: 2/4 by 11:50 PM

Learning Objectives

  • writing a C++ program that does input and output
  • using Math Library functions

Definition 1. Rectilinear motion is a continuous change of position of a body so that every particle of the body follows a straight-line path.

The variable quantities in a uniformly accelerated rectilinear motion are time, speed, distance covered and acceleration. Simple relations exist between these quantities. These relations are expressed in terms of equations called equations of motion. One such equation is

vf =

2 as + v^2 i (1)

where a is the acceleration, s is the distance covered, vi is the initial velocity, and vf is the final velocity.

Write a C++ program that prompts the user for the value of the accel- eration in f t s 2 , initial velocity in f t s , and the distance covered in f t. Your program should then compute and display the final velocity in f t s. Your pro- gram should also convert the final velocity to m s and display this quantity.

1 m s is approximately equals to 3.281 f t s. All numeric values in the output should be displayed with five decimal places and the input and output MUST be formatted as below. Name your source file linearmotion.cpp.

Your program interactions should appear as shown in the sample run. Be sure to format the output of your program exactly as shown below.

Sample Run:

Enter the acceleration of the particle in ft/s^2>xxx.xx Enter the distance covered by the particle in ft>x.xx Enter the initial velocity of the particle in ft/s>xxx.xx

A particle with a constant acceleration of xxx.xxxxx ft/s^2 starting with an initial velocity of xxx.xxxxx ft/s that travels a distance of xxxxx.xxxxx ft has a final velocity of xxx.xxxx ft/s which is equivalent to xxx.xxxx m/s.

As will be the case with every program you submit for grading in this course, your source file must have the following header comments:

/*

  • @file filename
  • @author your name
  • @date 9999-99-
  • Description: describe what the program does.
  • Course: CS1253 Section x
  • Logon ID: cs1253xx
  • Programming Project #: 1
  • Instructor: Duncan */