(Solved):
1. Write pseudocode and generate a flowchart that will take as input a fuel economy that is either ...
1. Write pseudocode and generate a flowchart that will take as input a fuel economy that is either in mpg (mile per gallon), fpo (feet per ounce), kpl (kilometers per liter), or mpcc (meters per cubic centimeter). The pseudocode and flowchart will print out the value of the fuel economy in all four units. 2. Use the lookfor command in MATLAB and determine the MATLAB command necessary to read data from a text file. 3. Use the help command in MATLAB and provide a definition of the floor command and list three different related commands. How does floor differ from round?
4. Given the length of the two bases (a, b) and height \( (\mathrm{h}) \) of the trapezoid shown below, the centroid of the trapezoid measured from the longest base b can be calculated using the formula \[ c=\frac{1}{3} \frac{2 a+b}{a+b} h \] The following program should calculate the centroid of a trapezoid measured from the longest base, given the length of the two bases and the height of the trapezoid. However, the MATLAB program contains several errors. Provide a list of all of the errors (explain why each is an error). Fix the program so that it correctly calculates the centroid of the trapezoid. Run the corrected code in MATLAB - what is the output of the program? Submit this corrected MATLAB program (it does not need to have a header or comments). Verify this result of your MATLAB program by drawing the trapezoid roughly to scale and indicate the location of the centroid given by the MATLAB program. Assume that the trapezoid is symmetric about the vertical. 5. The following three expressions are to be executed by a single MATLAB program. Assign \( a \) to be \( 0.28, b \) to be 1.65, and \( c \) to be 142.3E-4. Remember that the expressions are computer program assignments and are not mathematical equations. Turn in your .m file as well as the output from the command window from running your file. Verify your answers by doing hand calculations of the problems. Submit these hand calculations. \[ x=\frac{-b+\sqrt{b^{2}-4 a c}}{2 a} \] \[ a=e^{\frac{b}{a^{c}}}+\sin ^{-1}(1 / b) \] \[ y=\sqrt[4]{c}+(a-b)(b-c) \]
As per chegg policy, only one question can be answered. Answering the first question. Pseudocode: 1) Request 'fuel economy' value from user / command prompt