chapter 3 part 21 displaying output chapter 3 section 3.5output formatting chapter 3 section...

Download Chapter 3 Part 21 Displaying Output Chapter 3 Section 3.5Output Formatting Chapter 3 Section 3.6Group Boxes, etc. Chapter 3 Section 3.7Sample Program Chapter

Post on 30-Dec-2015

220 views

Category:

Documents

4 download

Embed Size (px)

TRANSCRIPT

  • Displaying OutputChapter 3 Section 3.5Output FormattingChapter 3 Section 3.6Group Boxes, etc.Chapter 3 Section 3.7Sample ProgramChapter 3 Section 3.8Logic Errors

    Chapter 3 Part 2

  • Number Formats

    Chapter 3 Part 2

  • FormatNumber FunctionDefault Format2 decimal placesCommas as neededSyntaxFormatNumber(value)ExamplesFormatNumber(12345.678)12,345.68*FormatNumber(12)12.00FormatNumber(.75)0.75Note: Rounding occurs.

    Chapter 3 Part 2

  • FormatNumber Function*Optional ArgumentFormatNumber(value, #decimal places)Examples:FormatNumber(4567, 4)4,567.0000FormatNumber(45678.473, 1)45,678.5FormatNumber(4567.243, 0)4,567Skip: bottom section of p. 139 & top p. 140

    Next several slides show values as arguments as examples;use variable names in real programs to avoid magic numbers.

    Chapter 3 Part 2

  • FormatCurrency FunctionDefault Format:Dollar signRounds to 2 decimal places.Examples:FormatCurrency(87321.784)$87,321.78FormatCurrency(44)$44.00FormatCurrency(3.658)$3.66

    Chapter 3 Part 2

  • FormatPercent FunctionDefault Format:Multiplies argument by 100Rounds to 2 decimal placesDisplays percent signExamples:FormatPercent(.783)78.30%FormatPercent(.48129)48.13%FormatPercent(55)5,500.00%FormatPercent(.3862, 1)38.6%

    Chapter 3 Part 2

  • FormatDateTimeSyntaxFormatDateTime(expression [, Format])

    Examples:FormatDateTime(systemDate, DateFormat.LongDate)Wednesday, September 17, 2003

    FormatDateTime(systemDate, DateFormat.ShortDate)9/17/03

    Chapter 3 Part 2

  • FormatDateTimeMore ExamplesFormatDateTime(systemDate, DateFormat.LongTime)03:22:18 PM

    FormatDateTime(systemDate, DateFormat.ShortDate)15:22

    FormatDateTime(systemDate, DateFormat.GeneralDate)09/17/2003 3:22:18 PM

    Chapter 3 Part 2

  • Label FormatsPropertiesSet TextAlign for values (typically right).CodelblTotal.Text = FormatCurrency(Total)

    Chapter 3 Part 2

  • Formatted Text and Captions

    Chapter 3 Part 2

  • GroupBox Control (p. 144)Appears as a rectangular border with an optional title in the upper-left corner.Contains and organizes controls.

    Chapter 3 Part 2

  • GroupBox Creation ProcessCreate GroupBox control first.Select the GroupBox.Double-click controls from toolbox to appear within the GroupBox.

    Other controls are part of GroupBox and move with it.

    Chapter 3 Part 2

  • GroupBox ControlMoving Existing Controls to ItSelect existing control(s).Cut the selected control(s).Select the GroupBox control.Paste the selected control(s).

    Chapter 3 Part 2

  • GroupBox TabIndexSet GroupBox control with Tab Order.Click controls inside GroupBox to provide tab order for those controls.

    Chapter 3 Part 2

  • GroupBox Access KeysGroupBox itself cannot have focus.You can use & to set an access key.When a person uses the access key, the focus moves to the control with the lowest TabIndex value inside the GroupBox control.

    Chapter 3 Part 2

  • Form Formatting (pp. 146-147)Selecting and Moving Multiple ControlsClick and drag a selection box around the controls.Press Ctrl as you click controls.

    Chapter 3 Part 2

  • Format Menu (Review)Align (p. 148)LeftsRightsCentersHorizontal AlignmentSize (p. 149)Make Same Size

    Chapter 3 Part 2

  • Form LoadExecutes when the form loads into memory.Example: declaring object variable to create instance of splash screen form (see Chapters 7 and 8)Double-click form to see Form Load event procedure.

    Chapter 3 Part 2

  • Section 3.7 Program DevelopmentComplete Section 3.7 to develop the Highlander Hotel program.Note design sketches (pp. 150-151).Study control planning grids, including Methods (pp. 151-153).Follow flowcharts (pp. 154-155).Hint: Study flowchart shapes in case you see a test question.Complete Tutorial 3-10 (pp. 156-161).

    Chapter 3 Part 2

  • Color Changes in Code (p. 159)ForeColor and BackColor PropertiesColor.Black Color.Red Color.BluelblOutput.ForeColor = Color.Blue

    Chapter 3 Part 2

  • Logic Errors (p. 162)Mistake that does not prevent a program from running BUT causes the program to produce inaccurate results.Examples:Mathematical errorsCopying value to the wrong variableIncorrect assignment of constant values.

    Chapter 3 Part 2

  • Debugging Logic ErrorsRead through Section 3.8.Complete Tutorial 3-12 (pp. 162-167).Set a breakpointline selected in code.

    Chapter 3 Part 2

  • Checkpoints for Individual Reviewpage 144pages 149 and 150page 168

    Answers at end of book

    Chapter 3 Part 2

  • Additional ReviewSummaryReview QuestionsFill-in-the-blankTrue or FalseMultiple ChoiceShort AnswerWhat Do You Think?Find the ErrorAlgorithm WorkbenchAnswers on ftp site.

    Chapter 3 Part 2