DOC PREVIEW
SJSU ME 30 - Week4Lab_repetition

This preview shows page 1 out of 2 pages.

Save
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

SAN JOS STATE UNIVERSITY Department of Mechanical and Aerospace Engineering ME 30 Computer Applications Lab Project 4 Repetition Control Structures Introduction In this lab session we ll learn about the control structures for repetition loops while do while and for Objectives Following completion of today s lab you should be able to Describe the three kinds of repetition structures while do while and for loops Write programs using repetition control structures Procedure If there are not enough computers to work at individually then find a partner to work with If you do work with a partner make sure that you take turns at the keyboard during the lab session Download a copy of the Lab Report Template lab rpt tpt doc from Desire2learn or the ME 30 website Use the template to record your answers to the lab exercises Make sure that you fill out the cover page completely before turning in your report Points will be deducted if the cover sheet is not completely filled out Enter your last name first initial and project number in the labeled boxes in the header by double clicking on it Under the section of the cover sheet labeled Summary summarize the problem s you solved You must also include a summary of the strategy you used as well as the methods you employed and any observations or conclusions about what you learned from the laboratory This is perhaps the most important part of the lab so do a good job on it Note that you are not limited to fitting the summary on the cover sheet You can expand the summary to another sheet if needed Save your work on your own USB storage device or email a softcopy to yourself before you leave the lab The hard drives on the computers in the lab are frequently refreshed so do not rely on them for saving your work from session to session Instructions for turning in your Lab Project report 1 Save your report using the following naming convention all lower case lastname firstinitial sec n lab4 report doc where n is your lab section number Tues 2 Wed 3 Thurs 4 so if your name is John Smith and you are in section 3 you must name your file smith j sec 3 lab4 report doc 2 Upload your report and any related files to Desire2Learn under the Week 4 Lab Project Dropbox before the deadline 3 Turn in a hard copy of your report at the beginning of next week s lab session BJ Furman ME 30 Computer Applications Week4Lab repetition doc 16FEB2010 Page 1 of 2 SAN JOS STATE UNIVERSITY Department of Mechanical and Aerospace Engineering ME 30 Computer Applications 1 Repetition Structures 1 1 Write a program using repetition that prints a table of the square and the cube of the integers from 0 to 10 Your table should be formatted in the following form x 0 1 2 x 2 0 1 4 etc x 3 0 1 8 Include pseudocode or a flowchart to show the logic of your program in your report Note that the symbol used in the header of the table to denote exponentiation is for readability only There is no built in operator for exponentiation in C In fact the symbol in C is actually an operator that does a bitwise exclusive logical OR between the operands on either side More on that later in the course There is a function declared in math h called pow that will do the job Check out your book or the C Standard Library for notes on usage for pow 1 2 The altitude vs time relationship for weather balloons is highly non linear due to effects of varying atmospheric air density and heating and cooling over the period of a day Assume that the following polynomial approximates the altitude of a weather balloon during its first 48 hours after launch where t is time in hours 1 h t 0 12t4 12t3 380t2 4100t 220 1 The corresponding polynomial approximation for the velocity of the balloon in m hr is v t 0 48t3 36t2 760t 4100 1 2 1 Write a program to print a table of the altitude and velocity of the balloon in units of meters and m s respectively note m s means meters second and equation 2 is in m hr over a 48 hour period Your table should look like Time hrs 0 1 2 2 2 Altitude m 220 00 Velocity m s 1 139 Modify your program to determine the maximum altitude the time at which it occurred and the velocity at this time Print these out at the bottom of your table The maximum altitude reached was xxxx yy meters at zz hours The velocity at this altitude was vvv tt meters second Include flowcharts to show the logic of your programs for 1 2 1 and 1 2 2 in your report 1 2 3 OPTIONAL EXTRA CREDIT Ch has some powerful functions for plotting which we have not yet talked about Explore the plotting capabilities of Ch and modify your program from 1 2 1 to plot the altitude as a function of time 1 Adapted from D Etter Engineering Problem Solving With C 3rd ed Pearson Education New Jersey 2005 pp 145 147 BJ Furman ME 30 Computer Applications Week4Lab repetition doc 16FEB2010 Page 2 of 2


View Full Document
Download Week4Lab_repetition
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Week4Lab_repetition and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Week4Lab_repetition and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?