Homework #4

Homework #4 - MAE9 Homework#4 Fall 2008 Turnin by Monday...

This preview shows pages 1–2. Sign up to view the full content.

Sheet1 Page 1 /* MAE9: Homework #4, Fall 2008 Turnin by Monday, October 27, by 9:00pm A mathematical relationship between x and y is described by the following expressions: y= A*x^2-B*x^3+x/4 if x<=0 (Case 1) y=A*x-B*x^4+C if 0<x<1 (Case 2) y=A*log10(x)-B/x-2*C if x>=1 (Case 3) where A, B, and C are constants. Write a C program that reads the double values of the constants A,B,C, and the argument x (by using scanf), and computes the corresponding value of y. Print x by using %f format with 4 decimal places, and print y by using %f format with 5 decimal places. Use the pow(a,b) function to calculate x^2, x^3 and x^4, and if/else statements to choose the proper expression for y, corresponding to selected x. After reading A,B,C, your program should use a do/while loop to evaluate y for scanned x in each of the above three cases. If you scan x from the same interval again, your program should ask you to scan x from another interval, until you scan x once from each interval.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern