ME 209 programming homework need help asap

profilebufhad
homework_2.pdf

ME209

Homework #2

1- Write a program to input the coefficients of a quadratic equation and solve for the roots. Apply your program to the equation

2

2

1,2

x 2x 3 0

4

2

b b ac x

a

  

   

output your labeled input and labeled results.

2- Temperatures may be converted from Celsius to Fahrenheit using the formula

F=1.8C 32

Write a program to input the temperature in Celsius and convert it to Fahrenheit. Try your program with C = -40°, C = 20°, and C = 100°.

(By the way, Excel have a conversion function called “convert”, I urge you to search the help file to learn more about it).

3- Polar coordinates are related to Cartesian Coordinates by the following equations. Write a program to input x = 2.5 and y = 7.1 to computer the r and θ. Then input r = 5.5 and θ = 49° to compute x and y.

2 2 1 cos( ) sin( ) tan ( )

y x r y r r x y

x   

     