 2003 Prentice Hall, Inc. All rights reserved. 1 Outline 11.1 Test-Driving the Interest Calculator Application 11.2 Essentials of Counter-Controlled Repetition.

Slides:



Advertisements
Similar presentations
Switch code for Lab 4.2 switch (input) { /* input is a variable that we will test. */ case 'M': printf("The prefix is equal to 1E6.\n"); break; case 'k':
Advertisements

© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 12 – Security Panel Application Introducing.
Microsoft Visual Basic: Reloaded Chapter Seven More on the Repetition Structure.
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
Microsoft Visual Basic: Reloaded Chapter Six Repeating Program Instructions.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 4 – Introducing Algorithms, Pseudocode and.
Iteration (Looping Constructs in VB) Iteration: Groups of statements which are repeatedly executed until a certain test is satisfied Carrying out Iteration.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic JavaScript: Control Structures: continued.
Control Structures: Part 2. Introduction Essentials of Counter-Controlled Repetition For / Next Repetition Structure Examples Using the For / Next Structure.
Car Payment Calculator – Chapter 9 (loops)
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 8 - Interest Calculator Application: Introducing.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 7 – Class Average Application: Introducing.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 6 – Car Payment Calculator Application: Introducing.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 9 Car Payment Calculator Application Introducing the Do While...Loop and Do Until...Loop.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 8 - JavaScript: Control Structures I Outline 8.1 Introduction 8.2 Algorithms 8.3 Pseudocode 8.4.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 16.1 Test-Driving the Flag Quiz Application.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Looping Exercises Deciding Which Loop to Use At this.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Six Repeating Program Instructions.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Interest Calculator Application Introducing the For...Next Repetition Statements.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Shipping Hub Application Introducing Generic Collections, LINQ, For Each...Next.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 30 – Bookstore Application: Client Tier Introducing.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 8 - Interest Calculator Application: Introducing.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 7.1 Test-Driving the Wage Calculator Application.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Seven More on the Repetition Structure.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 4 – Wage Calculator Application: Introducing.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 9 - JavaScript: Control Statements II Outline 9.1 Introduction 9.2 Essentials of Counter-Controlled.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 5 – Dental Payment Application: Introducing.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 5 – Control Structures: Part 2 Outline 5.1 Introduction 5.2 Essentials of Counter-Controlled.
 2002 Prentice Hall. All rights reserved. 1 Chapter 5 – Control Structures: Part 2 Outline 5.1Introduction 5.2 Essentials of Counter-Controlled Repetition.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved CheckWriter Application Introducing Graphics and Printing.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 9 – Income Tax Calculator Application: Introducing.
CSCI 3327 Visual Basic Chapter 4: Control Statements in Visual Basic (Part 2) UTPA – Fall 2011 Part of the slides is from Dr. John Abraham’s previous.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 6 – Car Payment Calculator Application: Introducing.
University of Palestine software engineering department Introduction to data structures Control Statements: Part 1 instructor: Tasneem Darwish.
1 Week 6 The Repetition Structure. 2 The Repetition Structure (Looping) Lesson A Objectives After completing this lesson, you will be able to:  Code.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 17 – Flag Quiz Application Introducing One-Dimensional.
Chapter 6: The Repetition Structure
Tutorial 6 The Repetition Structure
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Security Panel Application Introducing the Select Case Multiple-Selection Statement.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Class Average Application Introducing the Do...Loop While and Do...Loop Until.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Flow Control (for) Outline 4.1Introduction 4.2The.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 7 – Class Average Application: Introducing.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 20.1 Test-Driving the Shipping Hub Application.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.1.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 25.1 Test-Driving the ATM Application 25.2.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 18 – Student Grades Application Introducing.
 2000 Deitel & Associates, Inc. All rights reserved. Chapter 10 - JavaScript/JScript: Control Structures II Outline 10.1Introduction 10.2Essentials of.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 5.1 Test-Driving the Inventory Application.
Sections 5.1 – 5.4 © Copyright by Pearson Education, Inc. All Rights Reserved.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 8.1 Test-Driving the Car Payment Calculator.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 15 – Fund Raiser Application Introducing.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 5 – Control Structures: Part 2 Outline 5.1 Introduction 5.2 Essentials of Counter-Controlled.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 10.1 Test-Driving the Interest Calculator.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 24.1 Test-Driving the Enhanced Car Payment.
Chapter 15 I’m on the Inside; You’re on the Outside (Nested Loops) Clearly Visual Basic: Programming with Visual Basic nd Edition.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 16 I’m on the Inside; You’re on the Outside.
Controlling Program Flow with Looping Structures
5.1 Introduction Problem Solving –Requires understanding of: Building blocks Program-construction principles BZUPAGES.COM.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Student Grades Application Introducing Two-Dimensional Arrays and RadioButton.
 2002 Prentice Hall. All rights reserved. 1 Chapter 5 – Control Structures: Part 2 Outline 5.1Introduction 5.2 Essentials of Counter-Controlled Repetition.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 17.1 Test-Driving the Student Grades Application.
CSCI 3327 Visual Basic Chapter 4: Control Statements in Visual Basic (Part 2B) UTPA – Fall 2011 Part of the slides is from Dr. John Abraham’s previous.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 9 - JavaScript: Control Structures II Outline 9.1 Introduction 9.2 Essentials of Counter-Controlled.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Enhanced Car Payment Calculator Application Introducing Exception Handling.
Tutorial 10 – Class Average Application Introducing the Do…Loop While and Do…Loop Until Repetition Statements Outline Test-Driving the Class Average.
Tutorial 9 - Car Payment Calculator Application Introducing the while Repetition Statement Outline 9.1 Test-Driving the Car Payment Calculator Application.
Tutorial 12 – Security Panel Application Introducing the Select Case Multiple-Selection Statement Outline Test-Driving the Security Panel Application.
CIS 16 Application Development Programming with Visual Basic
Chapter 6 Control Statements: Part 2
Presentation transcript:

 2003 Prentice Hall, Inc. All rights reserved. 1 Outline 11.1 Test-Driving the Interest Calculator Application 11.2 Essentials of Counter-Controlled Repetition 11.3 Introducing the For…Next Repetition Statement 11.4 Examples Using the For…Next Statement 11.5 Constructing the Interest Calculator Application 11.6 Wrap-Up Tutorial 11 – Interest Calculator Application Introducing the For…Next Repetition Statement

 2003 Prentice Hall, Inc. All rights reserved. 2 Objectives In this tutorial, you will learn to: –Execute statements repeatedly with the For…Next repetition statement. –Obtain user input with the NumericUpDown control. –Display information, using a multiline TextBox.

 2003 Prentice Hall, Inc. All rights reserved Test-Driving the Interest Calculator Application

 2003 Prentice Hall, Inc. All rights reserved Test-Driving the Interest Calculator Application Figure 11.1 Completed Interest Calculator application. Click to decrease number of years NumericUpDown control Click to increase number of years Executing the application

 2003 Prentice Hall, Inc. All rights reserved Test-Driving the Interest Calculator Application Enter data into application –Principal and interest rate entered –Using NumericUpDown control to increase years Program output –Output displayed in multiline TextBox –Vertical scrollbar enabled

 2003 Prentice Hall, Inc. All rights reserved Test-Driving the Interest Calculator Application Figure 11.2 Output of completed Interest Calculator application. Multiline TextBox displays application results

 2003 Prentice Hall, Inc. All rights reserved Essentials of Counter-Controlled Repetition Four essential elements of counter-controlled repetition: –The name of a control variable (or loop counter) that is used to determine the whether the loop continues to iterate –The initial value of a control variable –The increment (or decrement) by which the control variable is modified after each iteration –The condition that tests for the final value of the control variable

 2003 Prentice Hall, Inc. All rights reserved. Outline 8 Figure 11.3 Counter-controlled repetition example. Final value condition increment Control variable name Initial value

 2003 Prentice Hall, Inc. All rights reserved Introducing the For…Next Repetition Statement Figure 11.4 For … Next header components. For intCounter = 2 To 10 Step 2 For keywordInitial value of control variableFinal value of control varaibleIncrement of control variable Control variable name To keyword Step keyword

 2003 Prentice Hall, Inc. All rights reserved Introducing the For…Next Repetition Statement Figure 11.5 For … Next repetition statement UML activity diagram.

 2003 Prentice Hall, Inc. All rights reserved. Outline 11 Figure 11.6 Code segment for the Car Payment Calculator application that demonstrates the For … Next statement. Initialize control variable to 1 Counter’s final value The Next keyword

 2003 Prentice Hall, Inc. All rights reserved Constructing the Interest Calculator Application

 2003 Prentice Hall, Inc. All rights reserved Constructing the Interest Calculator Application Template Form in Design view –Adding NumericUpDown control –Adding a multiline TextBox Figure 11.8 Template Interest Calculator application Form in design view.

 2003 Prentice Hall, Inc. All rights reserved Constructing the Interest Calculator Application NumericUpDown control –Increment property –Increment property default value –ReadOnly property

 2003 Prentice Hall, Inc. All rights reserved Constructing the Interest Calculator Application Figure 11.9 NumericUpDown control added to Interest Calculator application. NumericUpDown control

 2003 Prentice Hall, Inc. All rights reserved Constructing the Interest Calculator Application Multiline TextBox –Can use scrollbar –Enable vertical scrollbar

 2003 Prentice Hall, Inc. All rights reserved Constructing the Interest Calculator Application Figure Multiline TextBox with vertical scrollbar added to the Form. Vertical scrollbar (disabled) Multiline TextBox

 2003 Prentice Hall, Inc. All rights reserved Constructing the Interest Calculator Application Declaring variables –Declaring a counter variable Retrieving user input –Storing user input into variables

 2003 Prentice Hall, Inc. All rights reserved Constructing the Interest Calculator Application Figure Application code for retrieving and storing user input. Input variable declaration Counter variable declaration Retrieve user input

 2003 Prentice Hall, Inc. All rights reserved Constructing the Interest Calculator Application Figure Application code for displaying a header in multiline TextBox. Appending header text to the output String Displaying header text in multiline TextBox Using ControlChars.Tab Using ControlChars.CrLf

 2003 Prentice Hall, Inc. All rights reserved Constructing the Interest Calculator Application Figure Application code for For…Next statement. Using the For…Next statement to format and append text to the output String

 2003 Prentice Hall, Inc. All rights reserved Constructing the Interest Calculator Application Figure Application code for displaying calculation results. Displaying in the multiline TextBox the result of the calculations performed in the For…Next statement Displaying results in a multiline TextBox

 2003 Prentice Hall, Inc. All rights reserved. Outline 23 InterestCalculator.vb (1 of 2)

 2003 Prentice Hall, Inc. All rights reserved. Outline 24 InterestCalculator.vb (2 of 2) Using a For…Next statement to calculate amount on deposit