This is an electronic version of the print textbook. Due to electronic rights restrictions, some third party content may be suppressed. Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. The publisher reserves the right to remove content from this title at any time if subsequent rights restrictions require it. For valuable information on pricing, previous editions, changes to current editions, and alternate formats, please visit www.cengage.com/highered to search by ISBN#, author, title, or keyword for materials in your areas of interest. Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it. THIRD EDITION CLEARLY VISUAL BASIC® PROGRAMMING WITH MICROSOFT® VISUAL BASIC® 2012 DIANE ZAK AustralialBrazillJapanlKorealMexicolSingaporelSpainlUnitedKingdomlUnitedStates Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it. ClearlyVisualBasic: ª2014CourseTechnology,CengageLearning ProgrammingwithMicrosoft ALLRIGHTSRESERVED.Nopartofthisworkcoveredbythecopyrighthereinmaybe VisualBasic2012,ThirdEdition reproduced,transmitted,storedorusedinanyformorbyanymeansgraphic,electronic, DianeZak ormechanical,includingbutnotlimitedtophotocopying,recording,scanning,digitizing, taping,Webdistribution,informationnetworks,orinformationstorageandretrieval ExecutiveEditor:KathleenMcMahon systems,exceptaspermittedunderSection107or108ofthe1976UnitedStates SeniorProductManager:AlyssaPratt CopyrightAct,withoutthepriorwrittenpermissionofthepublisher. EditorialAssistant:SarahRyan ContentProjectManager: Forproductinformationandtechnologyassistance,contactusat JenniferFeltri-George CengageLearningCustomer&SalesSupport,www.cengage.com/support QualityAssurance:NicoleSpoto Forpermissiontousematerialfromthistextorproduct, ArtDirector:CherylPearl,GEX submitallrequestsonlineatcengage.com/permissions CoverDesigner:GEXPublishingServices Furtherpermissionsquestionscanbeemailedto TextDesigner:ShawnGirsberger [email protected] SeniorPrintBuyer:JulioEsperas Proofreader:SuzanneHuizenga LibraryofCongressControlNumber:2013932801 Indexer:ConstanceA.Angelo ISBN-13:978-1-285-08410-7 Compositor:IntegraSoftwareServicesPvt.Ltd. ISBN-10:1-285-08410-1 CourseTechnology 20ChannelCenterStreet Boston,MA02210 USA Someoftheproductnamesandcompanynamesusedinthisbookhavebeenusedfor identificationpurposesonlyandmaybetrademarksorregisteredtrademarksoftheir respectivemanufacturersandsellers. CourseTechnology,apartofCengageLearning,reservestherighttorevisethis publicationandmakechangesfromtimetotimeinitscontentwithoutnotice. Example:Microsoft®isaregisteredtrademarkoftheMicrosoftCorporation. CengageLearningisaleadingproviderofcustomizedlearningsolutionswithoffice locationsaroundtheglobe,includingSingapore,theUnitedKingdom,Australia, Mexico,Brazil,andJapan.Locateyourlocalofficeat:www.cengage.com/global CengageLearningproductsarerepresentedinCanadabyNelsonEducation,Ltd. TolearnmoreaboutCourseTechnology,visit www.cengage.com/coursetechnology TolearnmoreaboutCengageLearning,visitwww.cengage.com Purchaseanyofourproductsatyourlocalcollegestoreoratourpreferredonlinestore www.cengagebrain.com Printed in the United States of America 1 2 3 4 5 6 7 19 18 17 16 15 14 13 Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it. Brief Contents iii Preface . . . . . . . . . . . . . . . . . . . . . . . . . .xii CHAPTER 1 I Am Not a Control Freak! (Control Structures) . . . . . . . . . 1 CHAPTER 2 First You Need to Plan the Party (Problem-Solving Process) . . 17 CHAPTER 3 I Need a Tour Guide (Introduction to Visual Basic 2012) . . . . 35 CHAPTER 4 Do-It-Yourself Designing (Designing Interfaces) . . . . . . . . 63 CHAPTER 5 The Secret Code (Assignment Statements) . . . . . . . . . . 87 CHAPTER 6 Where Can I Store This? (Variables and Constants) . . . . . . 107 CHAPTER 7 What’s Wrong With It? (Syntax, Logic, and Run Time Errors) . . 131 CHAPTER 8 Decisions, Decisions, Decisions (Selection Structure) . . . . . 151 CHAPTER 9 Time to Leave the Nest (Nested Selection Structures) . . . . . 185 CHAPTER 10 So Many Paths…So Little Time (Multiple-Alternative Selection Structures) . . . . . . . . . . . . . . . . . . . 211 CHAPTER 11 Testing, Testing…1, 2, 3 (Selecting Test Data) . . . . . . . . 237 CHAPTER 12 How Long Can This Go On? (Pretest Loops) . . . . . . . . . . 261 CHAPTER 13 Do It, Then Ask Permission (Posttest Loops) . . . . . . . . . 293 CHAPTER 14 Let Me Count the Ways (Counter-Controlled Loops) . . . . . . 305 CHAPTER 15 I’m on the Inside; You’re on the Outside (Nested Loops) . . . . 329 CHAPTER 16 I Hear You Are Breaking Up (Sub Procedures) . . . . . . . . . 353 CHAPTER 17 Talk to Me (Function Procedures) . . . . . . . . . . . . . . 383 CHAPTER 18 A Ray of Sunshine (One-Dimensional Arrays) . . . . . . . . . 403 CHAPTER 19 Parallel and Dynamic Universes (More on One-Dimensional Arrays) . . . . . . . . . . . . . . . . . . 431 CHAPTER 20 Table Tennis, Anyone? (Two-Dimensional Arrays) . . . . . . . 455 CHAPTER 21 Building Your Own Structure (Structures) . . . . . . . . . . . 479 Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it. BRIEF CONTENTS CHAPTER 22 I’m Saving for the Future (Sequential Access Files) . . . . . . 497 CHAPTER 23 The String Section (String Manipulation) . . . . . . . . . . . 515 CHAPTER 24 I’m Suffering from Information Overload (Access Databases) . . 539 CHAPTER 25 The Missing “LINQ” (Querying a Database) . . . . . . . . . . 569 iv CHAPTER 26 I Love This Class (Creating a Class) . . . . . . . . . . . . . 587 CHAPTER 27 Getting “Web-ified” (Web Applications) . . . . . . . . . . . . 611 APPENDIX A Data Types . . . . . . . . . . . . . . . . . . . . . . . . 645 APPENDIX B Answers to Mini-Quizzes and TRY THIS Exercises . . . . . .Online Index . . . . . . . . . . . . . . . . . . . . . . . . . . . 647 Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it. Contents v Preface . . . . . . . . . . . . . . . . . . . . . . . . . xii CHAPTER 1 I Am Not a Control Freak! (Control Structures) . . . . . . . . 1 Control Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 The Sequence Structure . . . . . . . . . . . . . . . . . . . . . . . . . . 2 The Selection Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 The Repetition Structure . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Key Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 CHAPTER 2 First You Need to Plan the Party (Problem-Solving Process) . . 17 How Do Programmers Solve Problems? . . . . . . . . . . . . . . . . . . . . .18 Step 1—Analyze the Problem . . . . . . . . . . . . . . . . . . . . . . . . 18 Step 2—Plan the Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . 20 Step 3—Desk-Check the Algorithm . . . . . . . . . . . . . . . . . . . . . . 24 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28 Key Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31 CHAPTER 3 I Need a Tour Guide (Introduction to Visual Basic 2012) . . . . 35 Ok, the Algorithm Is Correct. What’s Next? . . . . . . . . . . . . . . . . . . . .36 Creating a Visual Basic Windows Application . . . . . . . . . . . . . . . . . . .38 So Many Windows! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Creating the User Interface . . . . . . . . . . . . . . . . . . . . . . . . . .41 Save, Save, Save . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .45 Whose Property Is It? . . . . . . . . . . . . . . . . . . . . . . . . . . . . .45 Using the FORMAT Menu . . . . . . . . . . . . . . . . . . . . . . . . . . .50 Lock Them Down . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51 Ok, Let’s See the Interface in Action! . . . . . . . . . . . . . . . . . . . . . .52 Closing the Current Solution . . . . . . . . . . . . . . . . . . . . . . . . . .53 Opening an Existing Solution . . . . . . . . . . . . . . . . . . . . . . . . . .54 Exiting Visual Studio . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55 Key Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .56 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57 Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it. CONTENTS CHAPTER 4 Do-It-Yourself Designing (Designing Interfaces) . . . . . . . . 63 Delegating the Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 Making the Interface More User-Friendly . . . . . . . . . . . . . . . . . . . . . . 68 Do What I Tell You to Do . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 The Me.Close() Instruction . . . . . . . . . . . . . . . . . . . . . . . . . 74 vi Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Key Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 CHAPTER 5 The Secret Code (Assignment Statements) . . . . . . . . . . 87 The Fun Starts Here . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 The Val Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 Who’s in Charge of This Operation? . . . . . . . . . . . . . . . . . . . . . . . . . 91 Your Assignment, if You Choose to Accept It . . . . . . . . . . . . . . . . . . . . . 94 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 Key Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 CHAPTER 6 Where Can I Store This? (Variables and Constants) . . . . . . . 107 Using Shoe Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 So, What’s Your Type? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 Let’s Play the Name Game . . . . . . . . . . . . . . . . . . . . . . . . . . 110 You’ll Need a Reservation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 How Many Variables Should I Use? . . . . . . . . . . . . . . . . . . . . . . . . 111 The TryParse Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 Check, Please…I’m Ready to Go . . . . . . . . . . . . . . . . . . . . . . . . 115 Using Constants to Keep Things…Well, the Same . . . . . . . . . . . . . . . . . . 116 Dressing Up the Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 Key Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 CHAPTER 7 What’s Wrong With It? (Syntax, Logic, and Run Time Errors) . . . 131 There’s a Bug in My Soup! . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 Finding Syntax Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 Locating Logic Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 I’ve Reached My Breaking Point . . . . . . . . . . . . . . . . . . . . . . . . 141 Run Time Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 Key Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 CHAPTER 8 Decisions, Decisions, Decisions (Selection Structure) . . . . . 151 Someone Might Need to Make a Decision . . . . . . . . . . . . . . . . . . . . . 152 The If…Then…Else Statement . . . . . . . . . . . . . . . . . . . . . . . . . . 155 Stop That Runner! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it. Are We in the Black or in the Red? . . . . . . . . . . . . . . . . . . . . . 160 You Deserve a Bonus . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 Examining Another Problem Specification . . . . . . . . . . . . . . . . . . . 168 Hey, That’s Not the Way I Would Have Done It . . . . . . . . . . . . . . . . 173 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 Key Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 vii Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 CHAPTER 9 Time to Leave the Nest (Nested Selection Structures) . . . 185 Nested Selection Structures . . . . . . . . . . . . . . . . . . . . . . . . . 186 10-4, Over and Out . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 How Much Is It? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 That’s Way Too Logical for Me . . . . . . . . . . . . . . . . . . . . . . . . 198 Summary of Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 Key Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 CHAPTER 10 So Many Paths…So Little Time (Multiple-Alternative Selection Structures) . . . . . . . . . . . . . . . . . . 211 Which Way Should I Go? . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 The Fitness Spa Health Club Application . . . . . . . . . . . . . . . . . . . 213 Don’t Be So Sensitive . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 What’s the Next Case on the Docket? . . . . . . . . . . . . . . . . . . . . . 220 Using Select Case in the Fitness Spa Health Club Application . . . . . . . . . . 222 Specifying a Range of Values in a Case Clause’s ExpressionList . . . . . . . . . . 223 Coding the ABC Corporation Application . . . . . . . . . . . . . . . . . . . 224 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 Key Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 CHAPTER 11 Testing, Testing…1, 2, 3 (Selecting Test Data) . . . . . . 237 Will Your Application Pass the Test? . . . . . . . . . . . . . . . . . . . . . . 238 The Coffee Palace–Version 1 Application . . . . . . . . . . . . . . . . . . . . 238 The Coffee Palace–Version 2 Application . . . . . . . . . . . . . . . . . . . . 241 Stop! This Is a Restricted Area! . . . . . . . . . . . . . . . . . . . . . . . 243 The Shady Hollow Hotel Application . . . . . . . . . . . . . . . . . . . . . . 245 The CD Shop Application . . . . . . . . . . . . . . . . . . . . . . . . . . 247 The Tiger Hotel Application . . . . . . . . . . . . . . . . . . . . . . . . . 250 I Need to Tell You Something . . . . . . . . . . . . . . . . . . . . . . . 251 Just When You Thought It Was Safe . . . . . . . . . . . . . . . . . . . . . 253 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 Key Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it. CONTENTS CHAPTER 12 How Long Can This Go On? (Pretest Loops) . . . . . . . . . . 261 Over and Over Again . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 Do I Need a Loop? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 The Do…Loop Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 Counter Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 viii Cheerleader Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 My Dream Car Application . . . . . . . . . . . . . . . . . . . . . . . . . . . 274 The Sales Express Application . . . . . . . . . . . . . . . . . . . . . . . . . . 276 The InputBox Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 Can I Abbreviate That Assignment Statement? . . . . . . . . . . . . . . . . . . . 283 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 Key Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288 CHAPTER 13 Do It, Then Ask Permission (Posttest Loops) . . . . . . . . . . 293 Testing After the Fact . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 More on the Do…Loop Statement . . . . . . . . . . . . . . . . . . . . . . . . 296 Pseudocode and Flowchart Containing a Posttest Loop . . . . . . . . . . . . . . . 297 The Bouncing Robot Application . . . . . . . . . . . . . . . . . . . . . . . . . 297 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 Key Term . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 CHAPTER 14 Let Me Count the Ways (Counter-Controlled Loops) . . . . . . . 305 When Will It Stop? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 Spaceship–Version 1 Application . . . . . . . . . . . . . . . . . . . . . . . . 309 Spaceship–Version 2 Application . . . . . . . . . . . . . . . . . . . . . . . . 310 Hey, Turn That Noise Down! . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 The Monthly Payment Calculator Application . . . . . . . . . . . . . . . . . . . . 312 The Financial.Pmt Method . . . . . . . . . . . . . . . . . . . . . . . . . . . 314 But They Said There Were No Strings Attached . . . . . . . . . . . . . . . . . . 315 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 Key Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 CHAPTER 15 I’m on the Inside; You’re on the Outside (Nested Loops) . . . . . 329 One Loop Within Another Loop . . . . . . . . . . . . . . . . . . . . . . . . . . 330 What Time Is It? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 What Do I Owe Each Month? . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 But I Want to Do It a Different Way . . . . . . . . . . . . . . . . . . . . . . . 341 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 Key Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346 Copyright 2013 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.