Reference no: EM13867797
1) Describe the difference between a "for" and a "while" loop.
When can you use which type of loop?
When can you not use a "for" loop?
2) Chapra - Chapter 12 - Problem 12.1(a)
The code MsgBox displays the variable following MsgBox in a message box (you do not need to use a MsgBox). Work through the problem by hand and then you may check your work using a computer. To demonstrate that you understand loops, rewrite the program using a "while" loop as presented in the VBA handout. Draw a flow chart of your program. Be sure to comment / annotate the lines of
your code so that TA's can award credit for your work.
3) Chapra - Chapter 12 - Problem 12.7 in VBA.
You may use either a recursive function or subroutine to accomplish the problem. Draw a flow chart for your program. Be sure to comment / annotate the lines of your code so that TA's can award credit for your work.
4) Create a program that prompts the user to enter a scalar value for the outside air temperature. If the temperature is equal to or above 80°F, send a message to the command window telling the user to wear shorts. If the temperature is between 60°F and 80°F send a message to the command window telling the user that it is a beautiful day. If the temperature is equal to or below 60°F, send a message to the command window telling the user to wear a jacket or coat. (Adapted from Problem 8.12 of Moore, H., MATLAB for Engineers, 2nd Edition, Prentice Hall, 2009). Create this program in both VBA using "if" and "case" structures in each. When should each structure ("if" and "case") be used?