مقدمة في البرمجة Lecture 7. Write VB.net project using the for loop to calculate : 1- the sum of numbers from 1 to (A) numbers. 2- the sum of Odd numbers.

Slides:



Advertisements
Similar presentations
CS 4 Intro to Programming using Visual Basic Do Loops Patchrawat Uthaisombut University of Pittsburgh 1 based on lecture notes by D. Schneider.
Advertisements

Looping while … do …. Condition Process 2 Process 1 Y Repeated Loop.
Practical Programming COMP153-08S Lecture: Repetition Continued.
Microsoft Visual Basic: Reloaded Chapter Six Repeating Program Instructions.
Repetition Statements Repeating an Action A specified number of times While a Condition is True Until a Condition is True.
Introduction to Graphical User Interfaces. Objectives * Students should understand what a procedural program is. * Students should understand what an.
110-K1 Iterations (1) Up to now, need to call the procedure again (e.g. click again on a command button) To repeat a piece of code: Can also use loops:
1 Visual Basic for Applications (VBA) for Excel Prof. Yitzchak Rosenthal.
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 1B Introduction (Tutorial)
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Programming Examples to Accompany Structure Topic Please use speaker notes for additional information!
Lab 01 Forms in excel Tahani ALdweesh Insert form into your project. 2. Change form’s properties. 3. Put controls on the form. 4. Change controls’
Lecture 8 Visual Basic (2).
1 CC111 Lec9 : Visual Basic Visual Basic (3) Lecture 9.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Programming Test #1 Solutions. Multiple Choice 1. B) the grammar of the coding language 2. C) String 3. A) Single 4. C) 2Burgers4Me 5. B) Design Time.
Intro to More Controls in C#. C# Demonstration We already touched on labels and buttons Ad-hoc demo of controls – Textboxes Multiline – Checkbox – Radiobutton.
More While Loop Examples CS303E: Elements of Computers and Programming.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Fundamentals of GUI Programming. Objectives: At the end of the session, you should be able to: describe the guidelines that are used for creating user-friendly.
Visual Basic.net Textbox & Label Controls. Textbox Naming convention (txt) Primary use (user input) Can except numeric and character values.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Statements That Repeat. For...Next Loop Structure For counter = start To end Step increment statements Next counter Where Counter is tested to see if.
Programming with Visual C++: Concepts and Projects Chapter 2B: Reading, Processing and Displaying Data (Tutorial)
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.
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
Count and add list of numbers From user input and from file.
Graphical User Interface You will be used to using programs that have a graphical user interface (GUI). So far you have been writing programs that have.
Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions.
Practical Programming COMP153-06S Lecture 3: Making Decisions.
1 Advanced Computer Programming Lab Calculator Project.
2a – Object Oriented Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Created by Alia Al-Abdulkarim 2008 Visual Basic Vs. Java.
11/10/2016CS150 Introduction to Computer Science 1 Last Time  We covered “for” loops.
1 Chapter 4 – Decisions 4.1 Relational and Logical Operators (see other set of slides) 4.2 If Blocks (see other set of slides) 4.3 Select Case Blocks (see.
SUPPLIER MODULE User’s Guide. Step 1. Click Files Step 2. Click Supplier.
Calculator Program Explained by Arafa Hamed. First Designing The Interface Ask yourself how many places are there that will be used to input numbers?
Comments, Conditional Statements Continued, and Loops Engineering 1D04, Teaching Session 4.
Data and variables in Visual Basic. Annoucement Lecture on Thursday 7:30PM C106 Visual Basic download: 
Visual Basic 6 Programming Decide how many variables you need by looking at this form. There is one textbox for input and there are 3 labels for output,
CPSC 233 Tutorial 5 February 2 th /3 th, Java Loop Statements A portion of a program that repeats a statement or a group of statements is called.
Loop Blocks Chapter 6 Part A. Program Blocks 1.Actions- commands, messages, methods 2.Branches- decisions to be made 3.Loops- actions to be repeated.
MIC305 Week 6 Beyond controls Review of properties Differences with VB6: using classes and instances Programming constructs.
5a – While Loops Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Microsoft Visual C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
DEPARTMENT MODULE User’s Guide. Step 1. Click Files Step 2. Click Department.
Loops ISYS 350. Write a Program that asks user to enter any numbers and displays the largest number Process: Largest = the first number Get the next number.
Practical Programming COMP153-08A Lecture 4:Strings & Formatting.
while Repetition Structure
Labs for week 2.
Tutorial 10 – Class Average Application Introducing the Do…Loop While and Do…Loop Until Repetition Statements Outline Test-Driving the Class Average.
Repetition – For and Do While
3rd prep. – 2nd Term MOE Book Questions.
3rd prep. – 2nd Term MOE Book Questions.
Chapter 6 – Repetition 6.1 Do Loops 6.2 For...Next Loops
مراجعة الحاسب.
Department Array in Visual Basic
حلقات التكرار.
PROGRAMMING Program Development.
Chapter (3) - Looping Questions.
Web service.
Additional Topics in VB.NET
Movie Rater.
MIS 3200 – Unit 5.1 Iteration (looping) Working with List Items
Types of loops definite loop: A loop that executes a known number of times. Examples: Repeat these statements 10 times. Repeat these statements k times.
Final Revision sheet- term2
Final Revision sheet- term2
4d – Program Design Lingma Acheson CSCI N331 VB .NET Programming
Presentation transcript:

مقدمة في البرمجة Lecture 7

Write VB.net project using the for loop to calculate : 1- the sum of numbers from 1 to (A) numbers. 2- the sum of Odd numbers from 1 to (A) numbers. 3- the sum of Even numbers from 1 to (A) numbers. ** (A : any number input by user).

Create an Interface, Change properties:

Write a code : Double click on : 1- Button 1 : Dim i, a, x as integer a = Val(textbox1.text) x=0 For i =1 to a x= x + i Next i Textbox2.text = x

Write a code : Double click on : 2- Button 2 : Dim i, a, x as integer a = Val(textbox1.text) x=0 For i =1 to a step 2 x= x + i Next i Textbox3.text = x

Write a code : Double click on : 3- Button 3 : Dim i, a, x as integer a = Val(textbox1.text) x=0 For i =0 to a step 2 x= x + i Next i Textbox4.text = x

Write a code : Double click on : 4- Button 4 : Textbox1.text = “ “ Textbox2.text = “ “ Textbox3.text = “ “ Textbox4.text = “ “

Execute a program: - Input a number :

Execute a program: - When we Click on The sum of numbers button, the result will appear :

Execute a program: - When we Click on The sum of odd numbers button, the result will appear :

Execute a program: - When we Click on The sum of even numbers button, the result will appear :

Execute a program: - When we Click on Delete button, all textboxes will be clean:

Write VB.net project using the Do / While loop to calculate : 1- the sum of numbers from 1 to (A) numbers. 2- the sum of Odd numbers from 1 to (A) numbers. 3- the sum of Even numbers from 1 to (A) numbers. ** (A : any number input by user).

Create an Interface, Change properties:

Write a code : Double click on : 1- Button 1 : Dim i, a, x as integer a = Val(textbox1.text) x=0 i = 1 Do while i <= a x= x + i i = i +1 loop Textbox2.text = x

Write a code : Double click on : 2- Button 2 : Dim i, a, x as integer a = Val(textbox1.text) x=0 i = 1 Do while i <= a x= x + i i = i +2 loop Textbox3.text = x

Write a code : Double click on : 3- Button 3 : Dim i, a, x as integer a = Val(textbox1.text) x = 0 i = 0 Do while i <= a x= x + i i = i +2 loop Textbox4.text = x

Write a code : Double click on : 4- Button 4 : Textbox1.text = “ “ Textbox2.text = “ “ Textbox3.text = “ “ Textbox4.text = “ “

Execute a program: - Input a number :

Execute a program: - When we Click on The sum of numbers button, the result will appear :

Execute a program: - When we Click on The sum of odd numbers button, the result will appear :

Execute a program: - When we Click on The sum of even numbers button, the result will appear :

Execute a program: - When we Click on Delete button, all textboxes will be clean:

Write VB.net project using the Do Until Loop to calculate : 1- the sum of numbers from 1 to (A) numbers. 2- the sum of Odd numbers from 1 to (A) numbers. 3- the sum of Even numbers from 1 to (A) numbers. ** (A : any number input by user).

Create an Interface, Change properties:

Write a code : Double click on : 1- Button 1 : Dim i, a, x as integer a = Val(textbox1.text) x=0 i = 1 Do Until i > a x= x + i i = i +1 loop Textbox2.text = x

Write a code : Double click on : 2- Button 2 : Dim i, a, x as integer a = Val(textbox1.text) x=0 i = 1 Do Until i > a x= x + i i = i +2 loop Textbox3.text = x

Write a code : Double click on : 3- Button 3 : Dim i, a, x as integer a = Val(textbox1.text) x=0 i = 0 Do Until i > a x= x + i i = i +2 loop Textbox4.text = x

Write a code : Double click on : 4- Button 4 : Textbox1.text = “ “ Textbox2.text = “ “ Textbox3.text = “ “ Textbox4.text = “ “

Execute a program: - Input a number :

Execute a program: - When we Click on The sum of numbers button, the result will appear :

Execute a program: - When we Click on The sum of odd numbers button, the result will appear :

Execute a program: - When we Click on The sum of even numbers button, the result will appear :

Execute a program: - When we Click on Delete button, all textboxes will be clean: