Tutorial 6 Enhancing the Inventory Application Introducing Variables, Memory Concepts and Arithmetic
|
|
- Beverly Wright
- 6 years ago
- Views:
Transcription
1 Tutorial 6 Enhancing the Inventory Application Introducing Variables, Memory Concepts and Arithmetic Outline 6.1 Test-Driving the Enhanced Inventory Application 6.2 Variables 6.3 Handling the TextChanged Event 6.4 Memory Concepts 6.5 Arithmetic 1
2 2 Objectives In this tutorial, you will learn to: Create variables. Handle the TextChanged event. Apply basic memory concepts using variables. Use the precedence rules of arithmetic operators. Set breakpoints to debug applications.
3 6.1 Test-Driving the Enhanced Inventory Application 3 Application Requirements The inventory manager notices a flaw in your Inventory application. Although the application calculates the correct result, that result continues to display even after new data is entered. The only time the output changes is when the inventory manager clicks the Calculate Button again. You need to alter the Inventory application to clear the result as soon as the user enters new information into either of the TextBoxes, to avoid any confusion over the accuracy of your calculated result.
4 6.1 Test-Driving the Enhanced Inventory Application 4 Figure 6.1 Inventory application GUI displayed when the application is executed. Running the application
5 6.1 Test-Driving the Enhanced Inventory Application 5 Figure 6.2 Running the Inventory application. Using the application Enter data into the TextBoxes and click the Calculate Total Button Notice the result
6 6.1 Test-Driving the Enhanced Inventory Application 6 Figure 6.3 Modified Inventory application clears output Label after new input. Cleared output Label Notice the new feature The output Label is cleared when new data is entered
7 7 6.2 Variables Adding code to the application Rearranging control declarations Declaring a variable Data types Built-in data type
8 6.2 Variables 8 Figure 6.4 The unarranged control declarations
9 6.2 Variables 9 Figure 6.5 Rearranging and commenting the control declarations
10 6.2 Variables 10 Figure 6.6 Declaring variables in event handler btncalculate_click Click event handler Variable declarations
11 Variables Retrieving data from the user Data is stored in the TextBox s Text property The Int32.Parse function Converts a string to an int Explicit conversion Assignment operator
12 6.2 Variables 12 Figure 6.7 Retrieving numerical input from TextBoxes. Assigning user input to variables
13 6.2 Variables 13 Built-in (primitive) data types bool char float long short byte decimal int ulong ushort sbyte double uint object string Figure 6.8 C# built-in data types.
14 Variables Perform the multiplication Displaying the result Set the Label s Text property to the multiplication result
15 6.2 Variables 15 Figure 6.9 Multiplication using variables in btncalculate_click. Calculating and displaying the result
16 Variables Figure 6.10 Displaying the multiplication result using variables. Result of calculation Running the application Enter data Click the Calculate Total Button Notice the result
17 Handling the TextChanged Event Create the event handler for the first TextBox Double click the TextBox TextChanged event handler is created Clearing the value Use empty string Repeat for second TextBox
18 6.3 Handling the TextChanged Event 18 Figure 6.11 TextChanged event handler for Cartons per shipment: TextBox. TextChanged event handler
19 6.3 Handling the TextChanged Event 19 Figure 6.12 TextChanged event handler for Items per carton: TextBox.
20 1 using System; 2 using System.Drawing; 3 using System.Collections; 4 using System.ComponentModel; 5 using System.Windows.Forms; 6 using System.Data; 7 8 namespace Inventory 9 { 10 /// <summary> 11 /// Summary description for FrmInventory. 12 /// </summary> 13 public class FrmInventory : System.Windows.Forms.Form 14 { 15 // Label and TextBox display the number of cartons per shipment 16 private System.Windows.Forms.Label lblcartons; 17 private System.Windows.Forms.TextBox txtcartons; // Label and TextBox display the number of items per carton 20 private System.Windows.Forms.Label lblitems; 21 private System.Windows.Forms.TextBox txtitems; // Labels display the total value 24 private System.Windows.Forms.Label lbltotal; 25 private System.Windows.Forms.Label lbltotalresult; Outline Inventory.cs (1 of 5) Rearranging and commenting the control declarations 20
21 26 27 // Button calculates total value 28 private System.Windows.Forms.Button btncalculate; /// <summary> 31 /// Required designer variable. Outline Inventory.cs (2 of 5) /// </summary> 33 private System.ComponentModel.Container components = null; public FrmInventory() 36 { 37 // 38 // Required for Windows Form Designer support 39 // 40 InitializeComponent(); // 43 // TODO: Add any constructor code after InitializeComponent 44 // call 45 // 46 } /// <summary> 49 /// Clean up any resources being used. 50 /// </summary>
22 51 protected override void Dispose( bool disposing ) 52 { 53 if( disposing ) 54 { 55 if (components!= null) 56 { 57 components.dispose(); 58 } 59 } 60 base.dispose( disposing ); 61 } // Windows Form Designer generated code /// <summary> 66 /// The main entry point for the application. 67 /// </summary> 68 [STAThread] 69 static void Main() 70 { 71 Application.Run( new FrmInventory() ); 72 } 73 Outline Inventory.cs (3 of 5) 22
23 74 // handles Click event 75 private void btncalculate_click( 76 object sender, System.EventArgs e ) 77 { 78 // declare variables 79 int intcartons; 80 int intitems; 81 int intresult; // retrieve numbers from TextBoxes 84 intcartons = Int32.Parse( txtcartons.text ); 85 intitems = Int32.Parse( txtitems.text ); // multiply two numbers 88 intresult = intcartons * intitems; // display result in Label 91 lbltotalresult.text = Convert.ToString( intresult ); } // end method btncalculate_click 94 Outline Inventory.cs (4 of 5) Assigning a property s value to a variable Assigning a variable to a property 23
24 95 // handles TextChanged event for txtcartons 96 private void txtcartons_textchanged( 97 object sender, System.EventArgs e ) 98 { 99 lbltotalresult.text = ""; // clear output Label } // end method txtcartons_textchanged // handles TextChanged event for txtitems 104 private void txtitems_textchanged( 105 object sender, System.EventArgs e ) 106 { 107 lbltotalresult.text = ""; // clear output Label } // end method txtitems_textchanged } // end class FrmInventory 112 } Outline Defining a TextBox s TextChanged event Inventory.cs handler (5 of 5) Setting a TextBox s Text property to an empty string 24
25 Memory Concepts Figure 6.14 Memory location showing name and value of variable intcartons. intcartons 12 A simple variable Corresponds to actual location in the computer s memory Name Type Size Value
26 6.4 Memory Concepts 26 Figure 6.15 Memory locations after values for variables intcartons and intitems have been input. intcartons 12 intitems 10 Visualizing data The value of each variable is stored in a separate memory location
27 Memory Concepts Figure 6.16 Memory locations after a multiplication operation. intcartons 12 intitems 10 intresult 120 Using the variable s data Nondestructive when value is read from memory
28 28 Operator precedence 6.5 Arithmetic Operators in expressions contained within a pair of parentheses Unary positive and negative Multiplication and division operations Modulus (remainder) operations Addition and subtraction operations
29 6.5 Arithmetic 29 C# operation Arithmetic Algebraic expression C# expression operator Addition + f + 7 f + 7 Subtraction p c p c Multiplication * bm b * m Division / x / y or o x ȳ - r x y x / y Modulus (Remainder) % r modulo s r % s Unary Negative - e e Unary Positive + +g +g Figure 6.17 Arithmetic operators.
Tutorial 5 Completing the Inventory Application Introducing Programming
1 Tutorial 5 Completing the Inventory Application Introducing Programming Outline 5.1 Test-Driving the Inventory Application 5.2 Introduction to C# Code 5.3 Inserting an Event Handler 5.4 Performing a
More informationClasses in C# namespace classtest { public class myclass { public myclass() { } } }
Classes in C# A class is of similar function to our previously used Active X components. The difference between the two is the components are registered with windows and can be shared by different applications,
More informationTutorial 19 - Microwave Oven Application Building Your Own Classes and Objects
1 Tutorial 19 - Microwave Oven Application Building Your Own Classes and Objects Outline 19.1 Test-Driving the Microwave Oven Application 19.2 Designing the Microwave Oven Application 19.3 Adding a New
More informationUser-Defined Controls
C# cont d (C-sharp) (many of these slides are extracted and adapted from Deitel s book and slides, How to Program in C#. They are provided for CSE3403 students only. Not to be published or publicly distributed
More informationFlag Quiz Application
T U T O R I A L 17 Objectives In this tutorial, you will learn to: Create and initialize arrays. Store information in an array. Refer to individual elements of an array. Sort arrays. Use ComboBoxes to
More informationThis is the start of the server code
This is the start of the server code using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Net; using System.Net.Sockets;
More informationWeb Services in.net (2)
Web Services in.net (2) These slides are meant to be for teaching purposes only and only for the students that are registered in CSE4413 and should not be published as a book or in any form of commercial
More informationInheriting Windows Forms with Visual C#.NET
Inheriting Windows Forms with Visual C#.NET Overview In order to understand the power of OOP, consider, for example, form inheritance, a new feature of.net that lets you create a base form that becomes
More informationIntroduction to C# Applications
1 2 3 Introduction to C# Applications OBJECTIVES To write simple C# applications To write statements that input and output data to the screen. To declare and use data of various types. To write decision-making
More informationChapter 2: Using Data
Chapter 2: Using Data Declaring Variables Constant Cannot be changed after a program is compiled Variable A named location in computer memory that can hold different values at different points in time
More informationPolymorphism. Polymorphism. CSC 330 Object Oriented Programming. What is Polymorphism? Why polymorphism? Class-Object to Base-Class.
Polymorphism CSC 0 Object Oriented Programming Polymorphism is considered to be a requirement of any true -oriented programming language (OOPL). Reminder: What are the other two essential elements in OOPL?
More informationCALCULATOR APPLICATION
CALCULATOR APPLICATION Form1.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;
More information1. Windows Forms 2. Event-Handling Model 3. Basic Event Handling 4. Control Properties and Layout 5. Labels, TextBoxes and Buttons 6.
C# cont d (C-sharp) (many of these slides are extracted and adapted from Deitel s book and slides, How to Program in C#. They are provided for CSE3403 students only. Not to be published or publicly distributed
More informationListBox. Class ListBoxTest. Allows users to add and remove items from ListBox Uses event handlers to add to, remove from, and clear list
C# cont d (C-sharp) (many of these slides are extracted and adapted from Deitel s book and slides, How to Program in C#. They are provided for CSE3403 students only. Not to be published or publicly distributed
More informationCSC 330 Object-Oriented Programming. Encapsulation
CSC 330 Object-Oriented Programming Encapsulation Implementing Data Encapsulation using Properties Use C# properties to provide access to data safely data members should be declared private, with public
More informationLECTURE 3 C++ Basics Part 2
LECTURE 3 C++ Basics Part 2 OVERVIEW Operators Type Conversions OPERATORS Operators are special built-in symbols that have functionality, and work on operands. Operators are actually functions that use
More informationVisual C# Instructor s Manual Table of Contents
Visual C# 2005 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion Topics Additional Projects Additional Resources Key Terms
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationReview: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements
Review: Exam 1 9/20/06 CS150 Introduction to Computer Science 1 1 Your First C++ Program 1 //*********************************************************** 2 // File name: hello.cpp 3 // Author: Shereen Khoja
More informationArrays. Arrays: Declaration and Instantiation. Array: An Array of Simple Values
What Are Arrays? CSC 0 Object Oriented Programming Arrays An array is a collection variable Holds multiple values instead of a single value An array can hold values of any type Both objects (reference)
More informationLampiran B. Program pengendali
Lampiran B Program pengendali #pragma once namespace serial using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms;
More informationnamespace Tst_Form { private: /// <summary> /// Required designer variable. /// </summary> System::ComponentModel::Container ^components;
Exercise 9.3 In Form1.h #pragma once #include "Form2.h" Add to the beginning of Form1.h #include #include For srand() s input parameter namespace Tst_Form using namespace System; using
More informationConvertor Binar -> Zecimal Rosu Alin, Calculatoare, An2 Mod de Functionare: Am creat un program, in Windows Form Application, care converteste un
Convertor Binar -> Zecimal Rosu Alin, Calculatoare, An2 Mod de Functionare: Am creat un program, in Windows Form Application, care converteste un numar binar, in numar zecimal. Acest program are 4 numericupdown-uri
More informationOperators. Lecture 3 COP 3014 Spring January 16, 2018
Operators Lecture 3 COP 3014 Spring 2018 January 16, 2018 Operators Special built-in symbols that have functionality, and work on operands operand an input to an operator Arity - how many operands an operator
More informationAn array can hold values of any type. The entire collection shares a single name
CSC 330 Object Oriented Programming Arrays What Are Arrays? An array is a collection variable Holds multiple values instead of a single value An array can hold values of any type Both objects (reference)
More informationLesson 02 Working with Data Types MIT 31043, Visual Programming By: S. Sabraz Nawaz
Lesson 02 Working with Data Types MIT 31043, Visual Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT Faculty of Management and Commerce South Eastern University of Sri Lanka Variables
More informationIn order to create your proxy classes, we have provided a WSDL file. This can be located at the following URL:
Send SMS via SOAP API Introduction You can seamlessly integrate your applications with aql's outbound SMS messaging service via SOAP using our SOAP API. Sending messages via the SOAP gateway WSDL file
More informationLesson 02 Working with Data Types. MIT 31043: VISUAL PROGRAMMING By: S. Sabraz Nawaz Senior Lecturer in MIT
Lesson 02 Working with Data Types MIT 31043: VISUAL PROGRAMMING Senior Lecturer in MIT Variables A variable is a storage location in memory that is represented by a name. A variable stores data, which
More informationObjectives. Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments
Basics Objectives Introduce the core C# language features class Main types variables basic input and output operators arrays control constructs comments 2 Class Keyword class used to define new type specify
More informationBlank Form. Industrial Programming. Discussion. First Form Code. Lecture 8: C# GUI Development
Blank Form Industrial Programming Lecture 8: C# GUI Development Industrial Programming 1 Industrial Programming 2 First Form Code using System; using System.Drawing; using System.Windows.Forms; public
More informationOperatii pop si push-stiva
Operatii pop si push-stiva Aplicatia realizata in Microsoft Visual Studio C++ 2010 permite simularea operatiilor de introducere si extragere a elementelor dintr-o structura de tip stiva.pentru aceasta
More informationFirst start a new Windows Form Application from C# and name it Interest Calculator. We need 3 text boxes. 4 labels. 1 button
Create an Interest Calculator with C# In This tutorial we will create an interest calculator in Visual Studio using C# programming Language. Programming is all about maths now we don t need to know every
More informationVB FUNCTIONS AND OPERATORS
VB FUNCTIONS AND OPERATORS In der to compute inputs from users and generate results, we need to use various mathematical operats. In Visual Basic, other than the addition (+) and subtraction (-), the symbols
More informationChapter 2: Using Data
Chapter 2: Using Data TRUE/FALSE 1. A variable can hold more than one value at a time. F PTS: 1 REF: 52 2. The legal integer values are -2 31 through 2 31-1. These are the highest and lowest values that
More information.Net Technologies. Components of.net Framework
.Net Technologies Components of.net Framework There are many articles are available in the web on this topic; I just want to add one more article over the web by explaining Components of.net Framework.
More informationWeb Services in.net (7)
Web Services in.net (7) These slides are meant to be for teaching purposes only and only for the students that are registered in CSE4413 and should not be published as a book or in any form of commercial
More informationBasic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition
Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators JAVA Standard Edition Java - Basic Operators Java provides a rich set of operators to manipulate variables.
More informationFull file at
Java Programming, Fifth Edition 2-1 Chapter 2 Using Data within a Program At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional
More informationJAVA OPERATORS GENERAL
JAVA OPERATORS GENERAL Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators
More informationDigiPen Institute of Technology
DigiPen Institute of Technology Presents Session Two: Overview of C# Programming DigiPen Institute of Technology 5001 150th Ave NE, Redmond, WA 98052 Phone: (425) 558-0299 www.digipen.edu 2005 DigiPen
More informationSub To Srt Converter. This is the source code of this program. It is made in C# with.net 2.0.
Sub To Srt Converter This is the source code of this program. It is made in C# with.net 2.0. form1.css /* * Name: Sub to srt converter * Programmer: Paunoiu Alexandru Dumitru * Date: 5.11.2007 * Description:
More information1.3b Type Conversion
1.3b Type Conversion Type Conversion When we write expressions involved data that involves two different data types, such as multiplying an integer and floating point number, we need to perform a type
More informationChapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics
Java Programming, Sixth Edition 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional Projects Additional
More informationFundamentals of Programming
Fundamentals of Programming Lecture 3 - Constants, Variables, Data Types, And Operations Lecturer : Ebrahim Jahandar Borrowed from lecturer notes by Omid Jafarinezhad Outline C Program Data types Variables
More informationA complex expression to evaluate we need to reduce it to a series of simple expressions. E.g * 7 =>2+ 35 => 37. E.g.
1.3a Expressions Expressions An Expression is a sequence of operands and operators that reduces to a single value. An operator is a syntactical token that requires an action be taken An operand is an object
More informationLe L c e t c ur u e e 2 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Variables Operators
Course Name: Advanced Java Lecture 2 Topics to be covered Variables Operators Variables -Introduction A variables can be considered as a name given to the location in memory where values are stored. One
More informationProgramming in C++ 5. Integral data types
Programming in C++ 5. Integral data types! Introduction! Type int! Integer multiplication & division! Increment & decrement operators! Associativity & precedence of operators! Some common operators! Long
More informationBy the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program
1 By the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program variables. Apply C++ syntax rules to declare variables, initialize
More informationOperators. Java operators are classified into three categories:
Operators Operators are symbols that perform arithmetic and logical operations on operands and provide a meaningful result. Operands are data values (variables or constants) which are involved in operations.
More informationCIS133J. Working with Numbers in Java
CIS133J Working with Numbers in Java Contents: Using variables with integral numbers Using variables with floating point numbers How to declare integral variables How to declare floating point variables
More informationYou can call the project anything you like I will be calling this one project slide show.
C# Tutorial Load all images from a folder Slide Show In this tutorial we will see how to create a C# slide show where you load everything from a single folder and view them through a timer. This exercise
More informationMicrosoft Visual Basic 2005: Reloaded
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 3 Variables, Constants, Methods, and Calculations Objectives After studying this chapter, you should be able to: Declare variables and named
More informationVisual Studio.NET.NET Framework. Web Services Web Forms Windows Forms. Data and XML classes. Framework Base Classes. Common Language Runtime
Intro C# Intro C# 1 Microsoft's.NET platform and Framework.NET Enterprise Servers Visual Studio.NET.NET Framework.NET Building Block Services Operating system on servers, desktop, and devices Web Services
More informationBasics of Java Programming
Basics of Java Programming Lecture 2 COP 3252 Summer 2017 May 16, 2017 Components of a Java Program statements - A statement is some action or sequence of actions, given as a command in code. A statement
More informationModule 2 - Part 2 DATA TYPES AND EXPRESSIONS 1/15/19 CSE 1321 MODULE 2 1
Module 2 - Part 2 DATA TYPES AND EXPRESSIONS 1/15/19 CSE 1321 MODULE 2 1 Topics 1. Expressions 2. Operator precedence 3. Shorthand operators 4. Data/Type Conversion 1/15/19 CSE 1321 MODULE 2 2 Expressions
More informationComputer Programming CS F111
Computer Programming CS F111 BITS Pilani Dubai Campus NAND KUMAR Basics of C Programming BITS Pilani Dubai Campus Write a program that 1. Asks 5 marks from the user, find the average of the marks and print
More informationC# Types. Industrial Programming. Value Types. Signed and Unsigned. Lecture 3: C# Fundamentals
C# Types Industrial Programming Lecture 3: C# Fundamentals Industrial Programming 1 Industrial Programming 2 Value Types Memory location contains the data. Integers: Signed: sbyte, int, short, long Unsigned:
More informationIndustrial Programming
Industrial Programming Lecture 3: C# Fundamentals Industrial Programming 1 C# Types Industrial Programming 2 Value Types Memory location contains the data. Integers: Signed: sbyte, int, short, long Unsigned:
More information9/10/10. Arithmetic Operators. Today. Assigning floats to ints. Arithmetic Operators & Expressions. What do you think is the output?
Arithmetic Operators Section 2.15 & 3.2 p 60-63, 81-89 1 Today Arithmetic Operators & Expressions o Computation o Precedence o Associativity o Algebra vs C++ o Exponents 2 Assigning floats to ints int
More informationCMPT 125: Lecture 3 Data and Expressions
CMPT 125: Lecture 3 Data and Expressions Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University January 3, 2009 1 Character Strings A character string is an object in Java,
More informationWeb Services in.net (6) cont d
Web Services in.net (6) cont d These slides are meant to be for teaching purposes only and only for the students that are registered in CSE3403 and should not be published as a book or in any form of commercial
More informationObjectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program
Objectives Chapter 2: Basic Elements of C++ In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates
More informationChapter 2: Basic Elements of C++
Chapter 2: Basic Elements of C++ Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates
More informationChapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction
Chapter 2: Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 1 Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers
More informationC++ Programming: From Problem Analysis to Program Design, Third Edition
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 2: Basic Elements of C++ Objectives (continued) Become familiar with the use of increment and decrement operators Examine
More informationCSIS 1624 CLASS TEST 6
CSIS 1624 CLASS TEST 6 Instructions: Use visual studio 2012/2013 Make sure your work is saved correctly Submit your work as instructed by the demmies. This is an open-book test. You may consult the printed
More informationC# Fundamentals. Hans-Wolfgang Loidl School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh
C# Fundamentals Hans-Wolfgang Loidl School of Mathematical and Computer Sciences, Heriot-Watt University, Edinburgh Semester 1 2018/19 H-W. Loidl (Heriot-Watt Univ) F20SC/F21SC 2018/19
More informationArithmetic Operators. Binary Arithmetic Operators. Arithmetic Operators. A Closer Look at the / Operator. A Closer Look at the % Operator
1 A Closer Look at the / Operator Used for performing numeric calculations C++ has unary, binary, and ternary s: unary (1 operand) - binary ( operands) 13-7 ternary (3 operands) exp1? exp : exp3 / (division)
More informationCSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York
CSc 10200! Introduction to Computing Lecture 2-3 Edgardo Molina Fall 2013 City College of New York 1 C++ for Engineers and Scientists Third Edition Chapter 2 Problem Solving Using C++ 2 Objectives In this
More informationBasic Operations jgrasp debugger Writing Programs & Checkstyle
Basic Operations jgrasp debugger Writing Programs & Checkstyle Suppose you wanted to write a computer game to play "Rock, Paper, Scissors". How many combinations are there? Is there a tricky way to represent
More informationII. Programming Technologies
II. Programming Technologies II.1 The machine code program Code of algorithm steps + memory addresses: MOV AX,1234h ;0B8h 34h 12h - number (1234h) to AX register MUL WORD PTR [5678h] ;0F7h 26h 78h 56h
More informationData and Variables. Data Types Expressions. String Concatenation Variables Declaration Assignment Shorthand operators. Operators Precedence
Data and Variables Data Types Expressions Operators Precedence String Concatenation Variables Declaration Assignment Shorthand operators Review class All code in a java file is written in a class public
More informationCourse PJL. Arithmetic Operations
Outline Oman College of Management and Technology Course 503200 PJL Handout 5 Arithmetic Operations CS/MIS Department 1 // Fig. 2.9: Addition.java 2 // Addition program that displays the sum of two numbers.
More informationAvoiding KeyStrokes in Windows Applications using C#
Avoiding KeyStrokes in Windows Applications using C# In keeping with the bcrypt.exe example cited elsewhere on this site, we seek a method of avoiding using the keypad to enter pass words and/or phrases.
More informationA flow chart is a graphical or symbolic representation of a process.
Q1. Define Algorithm with example? Answer:- A sequential solution of any program that written in human language, called algorithm. Algorithm is first step of the solution process, after the analysis of
More informationand event handlers Murach's C# 2012, C6 2013, Mike Murach & Associates, Inc. Slide 1
Chapter 6 How to code methods and event handlers Murach's C# 2012, C6 2013, Mike Murach & Associates, Inc. Slide 1 Objectives Applied 1. Given the specifications for a method, write the method. 2. Give
More informationCOMP Primitive and Class Types. Yi Hong May 14, 2015
COMP 110-001 Primitive and Class Types Yi Hong May 14, 2015 Review What are the two major parts of an object? What is the relationship between class and object? Design a simple class for Student How to
More informationChapter 3 Structure of a C Program
Chapter 3 Structure of a C Program Objectives To be able to list and describe the six expression categories To understand the rules of precedence and associativity in evaluating expressions To understand
More information12/14/2016. Errors. Debugging and Error Handling. Run-Time Errors. Debugging in C# Debugging in C# (continued)
Debugging and Error Handling Debugging methods available in the ID Error-handling techniques available in C# Errors Visual Studio IDE reports errors as soon as it is able to detect a problem Error message
More informationValues, Variables, Types & Arithmetic Expressions. Agenda
Values, Variables, Types & Arithmetic Expressions Lecture 2 Object-Oriented Programming Agenda Inside of a Computer Value Variable Data Types in Java Literals Identifiers Type conversions Manipulating
More informationThe Payroll User Interface: MODEL VIEW PRESENTER
agile.book Page 637 Friday, June 23, 2006 9:34 AM 38 The Payroll User Interface: MODEL VIEW PRESENTER As far as the customer is concerned, the Interface is the product. Jef Raskin Our payroll application
More informationChapter 3: Operators, Expressions and Type Conversion
101 Chapter 3 Operators, Expressions and Type Conversion Chapter 3: Operators, Expressions and Type Conversion Objectives To use basic arithmetic operators. To use increment and decrement operators. To
More information! A program is a set of instructions that the. ! It must be translated. ! Variable: portion of memory that stores a value. char
Week 1 Operators, Data Types & I/O Gaddis: Chapters 1, 2, 3 CS 5301 Fall 2016 Jill Seaman Programming A program is a set of instructions that the computer follows to perform a task It must be translated
More informationIntroduction to Microsoft.NET
Introduction to Microsoft.NET.NET initiative Introduced by Microsoft (June 2000) Vision for embracing the Internet in software development Independence from specific language or platform Applications developed
More informationBASIC ELEMENTS OF A COMPUTER PROGRAM
BASIC ELEMENTS OF A COMPUTER PROGRAM CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING LOGO Contents 1 Identifier 2 3 Rules for naming and declaring data variables Basic data types 4 Arithmetic operators
More informationChapter 2: Introduction to C++
Chapter 2: Introduction to C++ Copyright 2010 Pearson Education, Inc. Copyright Publishing as 2010 Pearson Pearson Addison-Wesley Education, Inc. Publishing as Pearson Addison-Wesley 2.1 Parts of a C++
More informationCSE 1001 Fundamentals of Software Development 1. Identifiers, Variables, and Data Types Dr. H. Crawford Fall 2018
CSE 1001 Fundamentals of Software Development 1 Identifiers, Variables, and Data Types Dr. H. Crawford Fall 2018 Identifiers, Variables and Data Types Reserved Words Identifiers in C Variables and Values
More informationC#: framework overview and in-the-small features
Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer C#: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer
More informationCHAPTER 3 BASIC INSTRUCTION OF C++
CHAPTER 3 BASIC INSTRUCTION OF C++ MOHD HATTA BIN HJ MOHAMED ALI Computer programming (BFC 20802) Subtopics 2 Parts of a C++ Program Classes and Objects The #include Directive Variables and Literals Identifiers
More informationChapter 2: Special Characters. Parts of a C++ Program. Introduction to C++ Displays output on the computer screen
Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Copyright 2009 Publishing Pearson as Pearson Education, Addison-Wesley Inc. Publishing as Pearson Addison-Wesley
More informationMidterms Save the Dates!
University of British Columbia CPSC 111, Intro to Computation Alan J. Hu Primitive Data Types Arithmetic Operators Readings Your textbook is Big Java (3rd Ed). This Week s Reading: Ch 2.1-2.5, Ch 4.1-4.2.
More informationDAD Lab. 1 Introduc7on to C#
DAD 2017-18 Lab. 1 Introduc7on to C# Summary 1..NET Framework Architecture 2. C# Language Syntax C# vs. Java vs C++ 3. IDE: MS Visual Studio Tools Console and WinForm Applica7ons 1..NET Framework Introduc7on
More informationLecture 3 Tao Wang 1
Lecture 3 Tao Wang 1 Objectives In this chapter, you will learn about: Arithmetic operations Variables and declaration statements Program input using the cin object Common programming errors C++ for Engineers
More informationOutline. Performing Computations. Outline (cont) Expressions in C. Some Expression Formats. Types for Operands
Performing Computations C provides operators that can be applied to calculate expressions: tax is 8.5% of the total sale expression: tax = 0.085 * totalsale Need to specify what operations are legal, how
More informationUnit 3. Operators. School of Science and Technology INTRODUCTION
INTRODUCTION Operators Unit 3 In the previous units (unit 1 and 2) you have learned about the basics of computer programming, different data types, constants, keywords and basic structure of a C program.
More informationExpressions and Casting
Expressions and Casting C# Programming Rob Miles Data Manipulation We know that programs use data storage (variables) to hold values and statements to process the data The statements are obeyed in sequence
More informationThe Open Core Interface SDK has to be installed on your development computer. The SDK can be downloaded at:
This document describes how to create a simple Windows Forms Application using some Open Core Interface functions in C# with Microsoft Visual Studio Express 2013. 1 Preconditions The Open Core Interface
More informationJava Primer 1: Types, Classes and Operators
Java Primer 1 3/18/14 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser, Wiley, 2014 Java Primer 1: Types,
More informationTwo Types of Types. Primitive Types in Java. Using Primitive Variables. Class #07: Java Primitives. Integer types.
Class #07: Java Primitives Software Design I (CS 120): M. Allen, 13 Sep. 2018 Two Types of Types So far, we have mainly been dealing with objects, like DrawingGizmo, Window, Triangle, that are: 1. Specified
More informationSOFTWARE DEVELOPMENT 1. Operators 2018W A. Ferscha (Institute of Pervasive Computing, JKU Linz)
SOFTWARE DEVELOPMENT 1 Operators 2018W (Institute of Pervasive Computing, JKU Linz) OPERATORS Operators are required to form expressions. Depending on the number of operands they take, they are called:
More information