Presentation is loading. Please wait.

Presentation is loading. Please wait.

Pemrograman VisualMinggu …2… Page 1 MINGGU Ke Dua Pemrograman Visual Pokok Bahasan: Console Application Tujuan Instruksional Khusus: Mahasiswa dapat menjelaskan.

Similar presentations


Presentation on theme: "Pemrograman VisualMinggu …2… Page 1 MINGGU Ke Dua Pemrograman Visual Pokok Bahasan: Console Application Tujuan Instruksional Khusus: Mahasiswa dapat menjelaskan."— Presentation transcript:

1

2 Pemrograman VisualMinggu …2… Page 1 MINGGU Ke Dua Pemrograman Visual Pokok Bahasan: Console Application Tujuan Instruksional Khusus: Mahasiswa dapat menjelaskan dan mengaplikasikan console apllication, tipe data, operator aritmatika, relational operator dan message dialogs Referensi: Deitel Deitel, Visual Basic 2008 (2009), How to Program, Prentice Hall. Chapter 3

3 Pemrograman VisualMinggu …2… Page 2 Agenda Displaying line of text Creating console application Adding Integer Memory concepts Arithmetic Equality and Relational operator Message Dialog to display message

4 Pemrograman VisualMinggu …2… Page 3 Displaying Line of Text

5 Pemrograman VisualMinggu …2… Page 4 Module Module1 Sub Main() Console.WriteLine("Wellcome to Visual Basic.NET") Console.ReadKey() End Sub End Module Perbedaan Write dengan WriteLine Fungsi ReadKey() Displaying Line of Text (Continued …)

6 Pemrograman VisualMinggu …2… Page 5 Creating a Console Application

7 Pemrograman VisualMinggu …2… Page 6 IDE with an open console application

8 Pemrograman VisualMinggu …2… Page 7 Renaming the program files in the properties windows

9 Pemrograman VisualMinggu …2… Page 8 Setting the Startup Object

10 Pemrograman VisualMinggu …2… Page 9 Writing Code and Using IntelliSense

11 Pemrograman VisualMinggu …2… Page 10 Parameter Info Window

12 Pemrograman VisualMinggu …2… Page 11 Running the program from the command prompt

13 Pemrograman VisualMinggu …2… Page 12 Syntax Error Indicated by the IDE

14 Pemrograman VisualMinggu …2… Page 13 Adding Integer

15 Pemrograman VisualMinggu …2… Page 14 Adding Integer (Continued …)

16 Pemrograman VisualMinggu …2… Page 15 The ReadLine method cause the program to pause and wait for user input, once the user presses the enter key, the input is returned to the program and execution resumes A Syntax error indicates a violation of visual basic’s rule for creating Adding Integer Summary

17 Pemrograman VisualMinggu …2… Page 16 Primitive Types

18 Pemrograman VisualMinggu …2… Page 17 Memory Concepts Variable names, such as number1, number2, total, correspond to locations in the computer’s memory Each variable has a name, type, size and value Whenever a value is placed in a memory location, it replaces the value previously stored in that location. The Previous value is destroyed When a value is read from a memory location, the process is nondestructive, meaning that the value in a memory is not changed

19 Pemrograman VisualMinggu …2… Page 18 Memory locations after an addition operation

20 Pemrograman VisualMinggu …2… Page 19 Arithmetic Operator

21 Pemrograman VisualMinggu …2… Page 20 Precedence of Arithmetic Operator

22 Pemrograman VisualMinggu …2… Page 21 Example Precedence of Arithmetic Operator

23 Pemrograman VisualMinggu …2… Page 22 Summary Arithmetic Binary operators operate on two operands; unary operator operate on one operand. The Mod operator yields the remainder after division. Arithmetic expressions in visual basic must be written in straight-line form to enter programs into a computer. Parentheses are used in visual basic expressions in the same manner as in algebraic expressions. Visual basic applies the operators in arithmetic expressions in a precise sequence, which is determine by the rule of the operator precedence If an expression contains multiple operator with the same precedence, the order in which the operators are applied is determined by their associability. In VB, all binary operators associate from left to right.

24 Pemrograman VisualMinggu …2… Page 23 Equality and Operational Operators

25 Pemrograman VisualMinggu …2… Page 24 Comparison with equality and relational operators

26 Pemrograman VisualMinggu …2… Page 25 Summary Equality and Operational Operators Visual Basic’s If… Then statement allows a program to make a decision based on the truth or falsity of a condition. If the condition is true, the statement in the body of the If… Then statement executes. If the condition is false, the body statement does not execute. Conditions in If… Then statements can be formed by using the equality operators and relational operators. Equality operators and relational operators are also called comparison operators. Relational and equality operators have the same level of precedence and associate from left to right

27 Pemrograman VisualMinggu …2… Page 26 Message dialog to display message

28 Pemrograman VisualMinggu …2… Page 27 Message dialog to display message (Continued …) Visual Basic provides class MessageBox for creating message dialogs Line 10 calls the Sqrt method of the Math class to compute the square root of 2. The value returned is a floating-point number, so we declare the variable root as type Double. Note the use of spacing in lines 13–14 of Fig. 3.28. To improve readability, long statements may be split over several lines using the line-continuation character, _. Line 13 uses the line-continuation character to indicate that line 14 is a continuation of the pre-ceding line. Lines 13–14 (Fig. 3.28) call method Show of class MessageBox. This method takes a comma-separated argument list. The first argument is the string that is displayed in the message dialog. The second argument is the string that is displayed in the message dialog’s title bar.

29 Pemrograman VisualMinggu …2… Page 28 Analyzing the MessageBox

30 Pemrograman VisualMinggu …2… Page 29 Summary Message dialog to display message Message dialogs are windows that display messages to the user. Visual Basic provides the class MessageBox for creating message dialogs. The.NET Framework Class Library organizes groups of related classes into namespaces. The System.Windows.Forms namespace contains windows-related classes (i.e., forms and dialogs) that help you define graphical user interfaces (GUIs) for their applications. GUI components facilitate data entry by the user and the formatting and presenting of data outputs to the user. An Imports statement indicates that a program uses the features provided by a specific namespace, such as System.Windows.Forms. To improve readability, long statements may be split over several lines with the line-continuation character ( _ ). Although a single statement can contain as many line-continuation characters as necessary, at least one whitespace character must precede each line-continuation character. Assemblies that contain compiled classes for reuse in applications are located in files with a.dll (dynamic link library) extension.

31 Pemrograman VisualMinggu …2… Page 30 Questions & Answers

32 Pemrograman VisualMinggu …2… Page 31 Thank You


Download ppt "Pemrograman VisualMinggu …2… Page 1 MINGGU Ke Dua Pemrograman Visual Pokok Bahasan: Console Application Tujuan Instruksional Khusus: Mahasiswa dapat menjelaskan."

Similar presentations


Ads by Google