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 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 Procedure The procedure for submitting your report will be somewhat similar to previous labs but with some important differences see below Fill out the answer sheets by typing your work in the soft copy version of this document Note everyone must turn in an individual lab report at the end of the session Download a copy of this document and fill out the cover sheet completely before starting on your answer sheets Points will be deducted if the cover sheet is not completely filled out When you complete your laboratory report save the file in pdf form and upload the pdf to the Lab 4 Assignment in Blackboard Cut and paste your source code into the table below in the cell denoted Implementation Put a cropped screenshot of the output window below your code If your program is too long to fit in the table cell put it on its own page with results below it Example File hello c Print Hello world on the screen include stdio h int main printf Hello world n return 0 When you write your programs use the structure shown in lecture and also demonstrated in the miles to kilometers c program available on the ME 30 website http www engr sjsu edu bjfurman courses ME30 source miles to kilometers c Under the section of the cover sheet labeled Description 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 before you leave the lab The hard drives on the computers in the lab are frequently refreshed so you ought not rely on them for saving your work from session to session BJ Furman ME 30 Computer Applications Week4Labproject 12SEP2009 doc 15SEP2009 Page 1 of 9 SAN JOS STATE UNIVERSITY Department of Mechanical and Aerospace Engineering ME 30 Computer Applications To get credit for this lab project you must also save your work on the desktop of the computer you used in the E407 lab using the following procedure Save your report using the following naming convention all lower case lastname firstinitial sec n lab4 report pdf 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 pdf Upload your report and any related files to Blackboard under the Lab 4 Assignment IMPORTANT Try to complete the lab project by the end of the laboratory session If you are unable to complete it by then you can submit it via Blackboard by midnight on the day of your lab and not be penalized for being late If you are unable to submit by midnight on the day of your lab you will be allowed to submit via Blackboard until the cutoff date but only for a possible maximum of half credit Assignments will not be accepted beyond the cutoff date time set in Blackboard References Cheng H H 2010 C for Engineers and Scientists An Interpretive Approach McGraw Hill New York ISBN 978 0073376059 BJ Furman ME 30 Computer Applications Week4Labproject 12SEP2009 doc 15SEP2009 Page 2 of 9 First Initial Last Name SAN JOS STATE UNIVERSITY Department of Mechanical and Aerospace Engineering ME 30 Computer Applications Proj Lab Project Report Cover Sheet Date Name print Last Name First Name Partners Project Title Description BJ Furman ME 30 Computer Applications Week4Labproject 12SEP2009 doc 15SEP2009 Page 3 of 9 Last Name First Initial SAN JOS STATE UNIVERSITY Department of Mechanical and Aerospace Engineering ME 30 Computer Applications 0 Repetition Structures Continuation of Score Averaging Problem from 09 14 09 Lecture 0 1 Write a program that calculates the average exam score for a class Specifications Prompts user for the number of scores to average Prompts user for each score Echoes each score entered Calculates the average score Prints out the average score No Problem Description and Analysis type below Data Requirements type below Problem Inputs Problem Outputs Algorithm type below BJ Furman ME 30 Computer Applications Week4Labproject 12SEP2009 doc 15SEP2009 Page 4 of 9 Last Name First Initial SAN JOS STATE UNIVERSITY Department of Mechanical and Aerospace Engineering ME 30 Computer Applications No Implementation your program and output Score for Grader s use Specifications Readability Documentation BJ Furman ME 30 Computer Applications Week4Labproject 12SEP2009 doc 15SEP2009 Page 5 of 9 Last Name First Initial 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 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 No Problem Description and Analysis type below Data Requirements type below Problem Inputs Problem Outputs Algorithm type below BJ Furman ME 30 Computer Applications Week4Labproject 12SEP2009 doc 15SEP2009 Page 6 of 9 Last Name First Initial SAN JOS STATE UNIVERSITY Department of Mechanical and Aerospace Engineering ME 30 Computer Applications No Implementation your program and output Score for Grader s use Specifications Readability Documentation BJ Furman ME 30 Computer Applications Week4Labproject 12SEP2009 doc 15SEP2009 Page 7 of 9 Last Name First Initial SAN JOS STATE UNIVERSITY Department of Mechanical and Aerospace Engineering ME 30 Computer Applications 2 1 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 h t 0 12t4 12t3 380t2 4100t 220 1 The corresponding polynomial approximation for the velocity of the balloon in m
View Full Document