es. Based on this input, the program computes and displays the ma ed by the projectile and the time taken to reach this height. hat the maximum height is reached when the vertical velocity (v, ight and vertical velocity are given below: ght vo sin(0) t - 0.5gt? V, = vo sin(0) -g the gravity acceleration to be defined as a constant wit

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
A projectile is launched at an angle theta, e, to the horizontal with an initial velocity (v, ). It rises
upwards to a maximum height while moving horizontally with a velocity (v, ). Write a ČSharp
program that prompts for and reads the initial velocity (v, ) in m/s and the angle theta in
degrees. Based on this input, the program computes and displays the maximum height, in meters,
reached by the projectile and the time taken to reach this height.
Note that the maximum height is reached when the vertical velocity (v, ) is 0o. The equations of
the height and vertical velocity are given below:
height = vo sin(0)t – 0.5gt?
V, = vo sin(0) – gt
Where:
g is the gravity acceleration to be defined as a constant with a value of 9.8 m/s?
180 degrees = n radians
n is to be defined as a constant with a value of 3.14159
max height
Transcribed Image Text:A projectile is launched at an angle theta, e, to the horizontal with an initial velocity (v, ). It rises upwards to a maximum height while moving horizontally with a velocity (v, ). Write a ČSharp program that prompts for and reads the initial velocity (v, ) in m/s and the angle theta in degrees. Based on this input, the program computes and displays the maximum height, in meters, reached by the projectile and the time taken to reach this height. Note that the maximum height is reached when the vertical velocity (v, ) is 0o. The equations of the height and vertical velocity are given below: height = vo sin(0)t – 0.5gt? V, = vo sin(0) – gt Where: g is the gravity acceleration to be defined as a constant with a value of 9.8 m/s? 180 degrees = n radians n is to be defined as a constant with a value of 3.14159 max height
To solve this problem, your program must contain, in addition to the main function, 3 other
functions:
• degToRad function that recelves the angle in degrees and returns it in radians.
• getTimeToPeak function that receives the initial velocity and the angle theta in radians and it
returns the time to reach the maximum height in seconds.
• getMaxHeight function that receives the initial velocity , the angle theta in radlans, and the
time to reach maximum height in seconds and returns the maximum height in meters.
The range of the valid input is:
0s 0 < 90 degrees
Vo 2 0
If the input is not valid, your program displays "Error: Wrong input" message and terminates.
Note:
• You must put the definition of the main function before those of degToRad, getTimeToPeak,
and getMaxHeight.
• The functions degToRad, getTimeTOPeak, and getMaxHeight must not contain any printf
or scanf calls. All reading and printing must be done in the main function.
Sample program runs:
vo in /s: 25.6
Enter theta in degrees: 85.3
Time to reach max height-2.60 secs
Maximum height - 33.21
Enter vo in m/s:-34.5
Enter theta in degrees: 40.5
Error: Wrong input
Enter vo in m/s: 30.8
Enter theta in degrees:
120.6
Error: Wrong input
Transcribed Image Text:To solve this problem, your program must contain, in addition to the main function, 3 other functions: • degToRad function that recelves the angle in degrees and returns it in radians. • getTimeToPeak function that receives the initial velocity and the angle theta in radians and it returns the time to reach the maximum height in seconds. • getMaxHeight function that receives the initial velocity , the angle theta in radlans, and the time to reach maximum height in seconds and returns the maximum height in meters. The range of the valid input is: 0s 0 < 90 degrees Vo 2 0 If the input is not valid, your program displays "Error: Wrong input" message and terminates. Note: • You must put the definition of the main function before those of degToRad, getTimeToPeak, and getMaxHeight. • The functions degToRad, getTimeTOPeak, and getMaxHeight must not contain any printf or scanf calls. All reading and printing must be done in the main function. Sample program runs: vo in /s: 25.6 Enter theta in degrees: 85.3 Time to reach max height-2.60 secs Maximum height - 33.21 Enter vo in m/s:-34.5 Enter theta in degrees: 40.5 Error: Wrong input Enter vo in m/s: 30.8 Enter theta in degrees: 120.6 Error: Wrong input
Expert Solution
steps

Step by step

Solved in 3 steps with 5 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY