C program to solve the quadratic equation of rocket launch

Assignment Help C/C++ Programming
Reference no: EM13162486

  1. You have your won space transport services such as SpaceX. You are testing new rocket designs. As the part of testing new rocket designs, you are checking their launching sequence. Consider you are launching a rocket straight up from 50 meters above ground (height) with 300 m/s velocity. You need to calculate when the rocket would fall down to earth. To solve this, you can represent this entire scenario through a quadratic equation (since we are not considering sending the rocket into space, we do not have to worry about other factors such as weight or drag).

    height = gravitational pull on the rocket (g) + velocity (v) + height of launch (l) = 0

    -5t2 + 300t + 50 = 0 (or) multiply by (-1) 5t2 - 300t - 50 = 0

    Note: height = 0 means the rocket has reached the earth, -5t2 is calculated by 1?2 at2 where a = 9.8 m/s2. So g is always around the value 5.

    Write a C program to solve the quadratic equation of rocket launch by computing the roots (t1 and t2) of that quadratic equation: gt2 + vt + l = 0 (or) for simplicity ax2 + bx + c = 0. Get the values of g, v, and l from the user. The program should determine the nature of roots (?)- whether the roots are real or imaginary and should print the roots for each case. The program should also consider the case where a = 0.

    ?=b2 -4ac(orv2 -4gl)

If ? ? 0 then the roots are real and given by,

?b+?b2 ?4ac
t1 = 2a and t1 =

?b??b2 ?4ac 2a

?b? i?? 2a

Note: Calculate real part and imaginary part separately. To print imaginary roots just add an "i" in printf.

page3image4784 page3image4944 page3image5104 page3image5264

If ? < 0 then the roots are imaginary and given by,

?b + i??
t1 = 2a and t1 =

page3image7184 page3image7344 page3image7504 page3image7664

If a = 0 then it becomes a linear equation and the root is given by,

t = ? bc

Reference no: EM13162486

Questions Cloud

Describe how to prepare 1l of a buffer : Explain how to prepare 1L of a buffer at pH 7.4 using 1M hypochlorous acid (Ka = 3.5 x 10-8) and a 1 M NaOH solution.
Determine the optimal size of the shopping center : Determine the optimal size of the shopping center (to the nearest 100 square meters) based on existing estimates of the demand for retail space.
First display the smallest volume and then the largest volum : first display the smallest volume and then the largest volume.
Compute the equilibrium constant kc for the reaction : Analysis shows that there are 1.8 moles of H2, 7.45e-05 moles of S2, and 7.2 moles of H2S present in a 50.8 L flask at equilibrium. Calculate the equilibrium constant Kc for the reaction.
C program to solve the quadratic equation of rocket launch : Write a C program to solve the quadratic equation of rocket launch by computing the roots (t1 and t2) of that quadratic equation: gt2 + vt + l = 0 (or) for simplicity ax2 + bx + c = 0. Get the values of g, v, and l from the user. The program should d..
Compute the partial pressure of no : At equilibrium the total pressure was 1.00 atm and the NOCl prssure was 0.27 atm. 2NOCl(g) &hArr 2NO(g) + Cl2(g) Calculate the partial pressure of NO and Cl2 in the system
State what is the partial pressure of ibr at equilibrium : What is the partial pressure of Br2 at equilibrium? What is the partial pressure of I2 at equilibrium? What is the partial pressure of IBr at equilibrium?
Compute the molar amounts of naoh used in the reaction : Calculate the molar amounts of NaOH used in the reaction with the HCI solution and with the HC2H3O2 solution?
Write a program with a while loop to print 1 to n in square : Write a program with a while loop to print 1 to N in square brackets. N is an integer input from the user. (i) Write the same program using a for-loop

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write c++ program that reads in the average monthly rainfall

Write a C++ program that reads in the average monthly rainfall for a city for each month of the year and then reads in the actual monthly rainfall for each of the previous 12 months

  Calculate the trajectory of a soccer ball

Write a program to calculate the trajectory (flight path) of a soccer ball

  Write a c function to convert gallons-quarts-pints and cups

Write a C function named liquid() that is to accept an integer number and the addresses of the variables gallons, quarts, pints, and cups.

  Write a program to calculate the area of a circle

Write a program to calculate the area of a circle. The program should use two procedures. The first procedure will print out the program heading and ask the user to enter the radius. The second procedure should calculate the area. The area of the cir..

  Write function to accept character array

Write down the C++ function which will accept the character array of at most 30 cells. Your function must return true if string and its reverse are identical;

  Write an input validation loop

write an input validation loop that asks the user to enter a number in the range of 1 through 4.

  Program to print out invalid number to character

The integer must contain 3 distinct non-zero number, or the program will print out invalid number.it should print out invalid query.

  Allows the user to enter the coefficients for a system

Create a graphical (not text-based) Visual C++ program that allows the user to enter the coefficients for a system of four equations with four unknowns. Include a button that when clicked, will solve the system of equations and display the results in..

  Write a program code to compute and build a table of reynold

Write a program code to compute and build a table of Reynolds numbers at flow velocities varying from 100 to 1000 ft/sec (at increments of 100)

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Write c program to accept inputs from user

Write down simple c program which accepts following inputs from user that is username and password, it must ask user what he will like to learn today and also ask user to enter char m=math , e= English.

  Create a base employee class

Create a base Employee class and a derived StudentEmployee class

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd