Calculator Program Explained by Arafa Hamed. First Designing The Interface Ask yourself how many places are there that will be used to input numbers?

Slides:



Advertisements
Similar presentations
EasyGUI “Probably the Easiest GUI in the world”. Assumptions (Teachers’ Notes) This resources sets out an introduction to using easyGUI and Python
Advertisements

VARIABLES AND DEBUGGING Beginning Programming. Assignment Statements  Used to hold values in a variable  Calculates a result and stores it in a variable.
CS0007: Introduction to Computer Programming Console Output, Variables, Literals, and Introduction to Type.
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
VBA for MS Excel Hamze Msheik. Open the Visual Basic Editor in Excel 2007 Click on the Microsoft Office button in the top left of the Excel window and.
ABNIAC The following slide presentation is to acquaint the student with ABNIAC. The version used for presentation is the Java version, which can be found.
To type the VB code behind the command button (named cmdPush), Double-Click on the Push Me (caption) command button As a result the Visual Basic Code Window.
Using Java's Math & Scanner class. Java's Mathematical functions (methods) (1)
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 6 Enhancing the Inventory Application Introducing Variables, Memory Concepts and.
MIS 3200 – Unit 6.2 Learning Objectives How to move data between pages – Using Query Strings How to control errors on web pages – Using Try-catch.
05/09/ Introducing Visual Basic Sequence Programming.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 1B Introduction (Tutorial)
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
06/10/ Working with Data. 206/10/2015 Learning Objectives Explain the circumstances when the following might be useful: Disabling buttons and.
Let’s get started using Visual Basic!. Private Sub cmdGo_Click... Dim strMessage As String Dim sngSum As Single If IsNumeric(txtNumber1.Text) = False.
08/10/ Iteration Loops For … To … Next. 208/10/2015 Learning Objectives Define a program loop. State when a loop will end. State when the For.
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’
Access VBA Programming for Beginners - Class 2 - by Patrick Lasu
Computer Programming TCP1224 Chapter 4 Variables, Constants, and Arithmetic Operators.
Chapter 4 Variables and constants. 4.1 Variables -Use of variables is good programming style -easier to modify -easier for a programmer to understand.
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.
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
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.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
MS Visual Basic Applications Walter Milner. Event-driven programming Standard approach for GUIs Contrast with old character interfaces – program determines.
ORDER OF CONTENT AND INSTRUCTIONS A program in its simplest form usually contains three kinds of activity:  INPUT : The program asks the user for some.
Chapter Two Creating a First Project in Visual Basic.
Programming with Visual C++: Concepts and Projects Chapter 2B: Reading, Processing and Displaying Data (Tutorial)
Data Types and Variables. Data Type! Computers are all about Data! Data can be in the form of Text Dates Sounds Pictures.
Getting Started with MATLAB (part2) 1. Basic Data manipulation 2. Basic Data Understanding 1. The Binary System 2. The ASCII Table 3. Creating Good Variables.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved. - edited by Maysoon Al-Duwais1.
CSC 157 (Blum)1 Hello World. CSC 157 (Blum)2 Start/Programs/Microsoft Visual Studio.NET 2003/Microsoft Visual Studio.NET 2003.
1 Advanced Computer Programming Lab Calculator Project.
Chapter 4 Variables and constants. 4.1 Variables -Use of variables is good programming style -easier to modify -easier for a programmer to understand.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
Hungarian Notation A must in this course Every object used MUST be renamed including the form(s) using the following rules Form  frmFormName E.g. frmTemperature.
Programming with Microsoft Visual Basic th Edition
Lesson 4 Mathematical Operators! October 6, 2009.
PROGRAMMING IN PYTHON LETS LEARN SOME CODE TOGETHER!
Lesson 1. Security At the menu bar at the top you will see the word Tools. Click your mouse on Tools scroll down to Macro. Move the Mouse over and down.
Chapter 4 Getting Started with VBA. Subroutines Subroutine is the logical section of code that performs a particular task. Subroutine is also called a.
31/01/ Selection If selection construct.
1 Project 2: Using Variables and Expressions. 222 Project 2 Overview For this project you will work with three programs Circle Paint Ideal_Weight What.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Student Grades Application Introducing Two-Dimensional Arrays and RadioButton.
2c – Textboxes and Buttons Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
مقدمة في البرمجة 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.
Tutorial 81 Field, Record, Data File Field - a single item of information about a person, place, or thing Record - a group of related fields that contain.
Steps for Developing a Visual C# 2010 Application MIT By: S. Sabraz Nawaz.
GCSE Computing: Programming GCSE Programming Remembering Python.
Visual Basic.NET Programming for the Rest of Us Keith Mulbery Utah Valley State College.
THE DOUBLE VARIABLE The double variable can hold very large (or small) numbers. The maximum and minimum values are 17 followed by 307 zero’s.
Knowledge Base. Defining a Variable Dim statement Dim intXX As Integer Public in a Module Public dblNN As Double.
Chapter 4: Variables, Constants, and Arithmetic Operators Introduction to Programming with C++ Fourth Edition.
Addison Wesley is an imprint of © 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 3 Variables and Calculations.
Microsoft Visual C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
Making Interactive Programs with Visual Basic .NET
Chapter 4.  Variables – named memory location that stores a value.  Variables allows the use of meaningful names which makes the code easier to read.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.
© 2006 Lawrenceville Press Slide 1 Chapter 4 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration.
Egyptian Language School Computer Department
A variable is a name for a value stored in memory.
Microsoft Visual Basic 2005 BASICS
Chapter (3) - Looping Questions.
Introduction to Programming
Presentation transcript:

Calculator Program Explained by Arafa Hamed

First Designing The Interface Ask yourself how many places are there that will be used to input numbers? The answer is two places for first number and second number. Which object enables user to input data? The answer is Textbox control.

What is the data that will be displayed on your calculator project? There are many data will be displayed such as : Number 1 Number 2 Result So you must use the object which displays fixed data that can not be changed by user this control is : Label control.

Ask yourself How many mathematical operations will be done by your calculator and how will execute them ? The answer is many mathematical operations and to execute them you must build Button which is used to execute your codes. After all the previous answers. You can design your project as follow :

After finishing the designing such as shown on the previous step : Think with me after the user inputs the numbers how can the computer receive them to process them The answer is we have to build Variables * The variable is a reserved place in the memory, its contents can be changed during program running.

To build a variable in the code window double click on the button object then use this rule for building variables : Dim VariableName As Data type Another question : How many variables do we need and why ? The answer is 3 variables 2 for numbers and one for result. Think which kind of data will be used ? The answer is Decimal.

After that you can build the variables as shown : Notes : if you use ( integer, long, short) data types computer will ignore the fraction but if you use ( decimal, double, single) data types computer will process the fraction.

Let’s think how can the variables get the data from the TextBox object and store them on the memory till the processing happen on it. The answer is so easy by using: Assignment Statement Number1 = Textbox1.text Number2 = Textbox2.text Result = Number1 + Number2 As displayed in the following screen:

Dear students may I ask a question? Is that possible the user input letters instead of numbers onto the TextBox ? The answer is ……………… yes. How can you prevent that happen ????? The answer is by using ( try – catch )which is used to discover the errors during the running of program as displayed in the following screen :

*** If the user input letters instead of numbers an error message will appear as shown on the following screen: *** By the way we use MsgBox to display error messages. We type it as shown on the previous code window

The last question is How the contents of Result variable which is found on the memory will be displayed on the screen after the computer makes processing on the numbers ? The answer by using this code : Label4.text = Result as shown on the following : Notes we use Label to display the result so, no one can change this result.

At the last type the codes into each button Encapsulation means to hide your codes and no one can reach them without permission This is what you have done when type the codes into the object.