You must implement a C++ program that calculates the position and velocity of a body thrown with an initial velocity (v0) and with an angle to the horizontal (angle). The results should be displayed on the screen every some time (0.1 seconds) in a horizontal row. To validate your program, use the following example run where v0=10 and angle=53o as shown in the image: The data must be printed with two decimal places, find out how to do this in C++. Once all the calculations are printed, the program must ask if you want to repeat or if you want to exit the program. You implement the way to do it. As always the report should include (use the standard report): Cover page with title, course and section, names and student numbers of your team members in alphabetical order by last name. Introduction indicating in one paragraph what the program does and pseudocode/algorithm of the program. Detailed flowchart. Source code. Pictures of a running example. Next, the theory of ballistics problems: Ballistics problems all start with an initial velocity due to the force of the gun. It is divided into two components, horizontal and vertical velocity.Suppose a cannon is fired with an angle to the horizontal of θ=53 degrees and initial velocity v0=10m/s. The velocity is decomposed into two components: v0x = v0cosθ = 6.01815m/s. v0y = v0sinθ = 7.98636m/s. The vertical velocity at each instant is calculated at any time t by subtracting from the initial velocity the negative velocity generated by the force of gravity (g=9.81). The formula is as follows: vy(t) = v0y - gt. The horizontal velocity at each instant is constant at all times (it is assumed that the air friction is is assumed to be zero). vx(t) = v0x The horizontal position at each instant is calculated with the formula: x(t)= vx(t)t The vertical position at each instant is calculated taking into account the initial vertical velocity and the force of gravity according to the formula: y(t) = v0yt - 0.5gt2. The program should end when the bullet returns to the ground (y=0). To calculate the time where the bullet reaches the ground the ground we must know the following. The time at which the ball reaches the maximum height is calculated by obtaining the time at which the vertical velocity is zero: vy(t) = 0 = v0y - gthmax. Therefore, thmax = v0y/g When the ball reaches the ground it has had to go up and down, therefore, tmax = 2thmax. The program must do the calculations up to that maximum time when the bullet is in the air. In short, the first thing the program has to do is to calculate the time the bullet will be in the air (tmax). To calculate the positions and velocities you must implement a for-loop, do the calculations every 0.1 seconds and print up to the maximum time, even if it is not a multiple of 0.1. Translated with www.DeepL.com/Translator (free version)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

You must implement a C++ program that calculates the position and velocity of a body thrown with an initial velocity (v0) and with an angle to the horizontal (angle). The results should be displayed on the screen every some time (0.1 seconds) in a horizontal row. To validate your program, use the following example run where v0=10 and angle=53o as shown in the image:

The data must be printed with two decimal places, find out how to do this in C++.
Once all the calculations are printed, the program must ask if you want to repeat or if you want to exit the program. You implement the way to do it.
As always the report should include (use the standard report):

Cover page with title, course and section, names and student numbers of your team members in alphabetical order by last name.
Introduction indicating in one paragraph what the program does and pseudocode/algorithm of the program. Detailed flowchart. Source code. Pictures of a running example.

Next, the theory of ballistics problems:

Ballistics problems all start with an initial velocity due to the force of the gun. It is divided into two components, horizontal and vertical velocity.Suppose a cannon is fired with an angle to the horizontal of θ=53 degrees and initial velocity v0=10m/s. The velocity is decomposed into two components:

v0x = v0cosθ = 6.01815m/s. v0y = v0sinθ = 7.98636m/s.

The vertical velocity at each instant is calculated at any time t by subtracting from the initial velocity the negative velocity generated by the force of gravity (g=9.81). The formula is as follows:

vy(t) = v0y - gt.

The horizontal velocity at each instant is constant at all times (it is assumed that the air friction is
is assumed to be zero).

vx(t) = v0x

The horizontal position at each instant is calculated with the formula:

x(t)= vx(t)t

The vertical position at each instant is calculated taking into account the initial vertical velocity and the force of gravity according to the formula:

y(t) = v0yt - 0.5gt2.

The program should end when the bullet returns to the ground (y=0). To calculate the time where the bullet reaches the ground the ground we must know the following.

The time at which the ball reaches the maximum height is calculated by obtaining the time at which the vertical velocity is zero:

vy(t) = 0 = v0y - gthmax.
Therefore, thmax = v0y/g

When the ball reaches the ground it has had to go up and down, therefore, tmax = 2thmax. The program must do the calculations up to that maximum time when the bullet is in the air.

In short, the first thing the program has to do is to calculate the time the bullet will be in the air (tmax). To calculate the positions and velocities you must implement a for-loop, do the calculations every 0.1 seconds and print up to the maximum time, even if it is not a multiple of 0.1.

Translated with www.DeepL.com/Translator (free version)

Inital speed ve :10. Angle: 53
v0x: 6.02
vey: 7.99
tFinal: 1.63
Number of measures: 17
t:
t0:
t1:
t2:
t3:
t4:
t5:
t6:
t7:
t8:
t9:
t10:
t11:
t12:
t13:
t14:
t15:
t16:
t17:
Vx.
vy.
урos.
0.00
secs.
хрos.
0.00
0.00
6.02
7.99
0.10
0.60
0.75
6.02
7.01
0.20
1.20
1.40
6.02
6.02
0.30
1.81
1.95
6.02
5.04
0.40
2.41
2.41
6.02
4.06
0.50
3.01
2.77
6.02
3.08
0.60
3.61
3.03
6.02
2.10
0.70
4.21
3.19
6.02
1.12
0.80
4.81
3.25
6.02
0.14
0.90
5.42
3.21
6.02
-0.84
1.00
6.02
3.08
6.02
-1.82
1.10
6.62
2.85
6.02
-2.80
1.20
7.22
2.52
6.02
-3.79
1.30
7.82
2.09
6.02
-4.77
1.40
8.43
1.57
6.02
-5.75
1.50
9.03
0.94
6.02
-6.73
1.60
9.63
0.22
6.02
-7.71
1.63
9.80
-0.00
6.02
-7.99
Process returned 0 (0x0)
Press any key to continue.
execution time : 0.142 s
Transcribed Image Text:Inital speed ve :10. Angle: 53 v0x: 6.02 vey: 7.99 tFinal: 1.63 Number of measures: 17 t: t0: t1: t2: t3: t4: t5: t6: t7: t8: t9: t10: t11: t12: t13: t14: t15: t16: t17: Vx. vy. урos. 0.00 secs. хрos. 0.00 0.00 6.02 7.99 0.10 0.60 0.75 6.02 7.01 0.20 1.20 1.40 6.02 6.02 0.30 1.81 1.95 6.02 5.04 0.40 2.41 2.41 6.02 4.06 0.50 3.01 2.77 6.02 3.08 0.60 3.61 3.03 6.02 2.10 0.70 4.21 3.19 6.02 1.12 0.80 4.81 3.25 6.02 0.14 0.90 5.42 3.21 6.02 -0.84 1.00 6.02 3.08 6.02 -1.82 1.10 6.62 2.85 6.02 -2.80 1.20 7.22 2.52 6.02 -3.79 1.30 7.82 2.09 6.02 -4.77 1.40 8.43 1.57 6.02 -5.75 1.50 9.03 0.94 6.02 -6.73 1.60 9.63 0.22 6.02 -7.71 1.63 9.80 -0.00 6.02 -7.99 Process returned 0 (0x0) Press any key to continue. execution time : 0.142 s
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education