Research Topics in Computational Science. Agenda Commenting Our Code Variable Review Button Program – Add Textbox Getting text from textbox Converting.

Slides:



Advertisements
Similar presentations
Variables in C Amir Haider Lecturer.
Advertisements

AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
ARDUINO CLUB Session 1: C & An Introduction to Linux.
C++ Basics Variables, Identifiers, Assignments, Input/Output.
Written by: Dr. JJ Shepherd
1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
Introduction to Programming with Java, for Beginners Primitive Types Expressions Statements Variables Strings.
CIS 234: Using Data in Java Thanks to Dr. Ralph D. Westfall.
C Programming Basics Lecture 5 Engineering H192 Winter 2005 Lecture 05
CMT Programming Software Applications
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming Expressions and Operators Program Style.
Some basic I/O.
Fundamental Programming Structures in Java: Comments, Data Types, Variables, Assignments, Operators.
Programming Part 1 Armond R. Smith Zhenying Wu. Overview of this Class ● Transition from FTC -> FRC ● Using Your Resources ● Java Keywords o Data Types.
CHAPTER 3: CORE PROGRAMMING ELEMENTS Introduction to Computer Science Using Ruby (c) 2012 Ophir Frieder et al.
What is RobotC?!?! Team 2425 Hydra. Overview What is RobotC What is RobotC used for What you need to program a robot How a robot program works Framework.
Week #2 Java Programming. Enable Line Numbering in Eclipse Open Eclipse, then go to: Window -> Preferences -> General -> Editors -> Text Editors -> Check.
Variables in Java Part 2. ICS-3M1 - Mr. Martens - Variables Part 2 Recall the “int” Data Types When you divide one integer by another – you always get.
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.
© Janice Regan, CMPT 128, Jan CMPT 128: Introduction to Computing Science for Engineering Students Data representation and Data Types Variables.
Jun 16, 2014IAT 2651 Debugging. Dialectical Materialism  Dialectical materialism is a strand of Marxism, synthesizing Hegel's dialectics, which proposes.
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Fundamentals (Comments, Variables, etc.)
Basic Java Programming CSCI 392 Week Two. Stuff that is the same as C++ for loops and while loops for (int i=0; i
Input, Output, and Processing
3 - Variables Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Chapter 4 Variables and constants. 4.1 Variables -Use of variables is good programming style -easier to modify -easier for a programmer to understand.
5 BASIC CONCEPTS OF ANY PROGRAMMING LANGUAGE Let’s get started …
Semester Review. As we have discussed, Friday we will have in class time for you to work on a program, this program will come with instructions and you.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
COMP 171: Data Types John Barr. Review - What is Computer Science? Problem Solving  Recognizing Patterns  If you can find a pattern in the way you solve.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 5P. 1Winter Quarter C Programming Basics.
1 Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
ECS 15 Variables. Outline  Using IDLE  Building blocks of programs: Text Numbers Variables!  Writing a program  Running the program.
Computing with C# and the.NET Framework Chapter 2 C# Programming Basics ©2003, 2011 Art Gittleman.
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 5P. 1Winter Quarter C Programming Basics Lecture 5.
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.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Data Tonga Institute of Higher Education. Variables Programs need to remember values.  Example: A program that keeps track of sales needs to remember.
Arithmetic Expressions Addition (+) Subtraction (-) Multiplication (*) Division (/) –Integer –Real Number Mod Operator (%) Same as regular Depends on the.
Written by: Dr. JJ Shepherd
Expressions and Order of Operations Operators – There are the standard operators: add, subtract, divide, multiply – Note that * means multiply? (No times.
What are Operators? Some useful operators to get you started.
Variables in C Topics  Naming Variables  Declaring Variables  Using Variables  The Assignment Statement Reading  Sections
Thinking about programming Intro to Computer Science CS1510 Dr. Sarah Diesburg.
CMSC 104, Version 8/061L09VariablesInC.ppt Variables in C Topics Naming Variables Declaring Variables Using Variables The Assignment Statement Reading.
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,
Python Basics  Values, Types, Variables, Expressions  Assignments  I/O  Control Structures.
Chad’s C++ Tutorial Demo Outline. 1. What is C++? C++ is an object-oriented programming (OOP) language that is viewed by many as the best language for.
Chapter 4.  Variables – named memory location that stores a value.  Variables allows the use of meaningful names which makes the code easier to read.
Eastside Robotics Alliance / Newport Robotics Group 1 T/Th, 6:30 – 8:30 PM Big Picture School Day 3 · 10/9/2014.
Last week: We talked about: History of C Compiler for C programming
A variable is a name for a value stored in memory.
Topics Designing a Program Input, Processing, and Output
Chapter 2 Basic Computation
Java Variables and Types
Variables, Expressions, and IO
Introduction to Programming in Java
Variables ICS2O.
Escape sequences: Practice using the escape sequences on the code below to see what happens. Try this next code to help you understand the last two sequences.
Arithmetic Expressions & Data Conversions
Recap Week 2 and 3.
See requirements for practice program on next slide.
Topics Designing a Program Input, Processing, and Output
Topics Designing a Program Input, Processing, and Output
Unit 3: Variables in Java
Variables in C Topics Naming Variables Declaring Variables
Arithmetic Expressions & Data Conversions
Getting Started in Python
Presentation transcript:

Research Topics in Computational Science

Agenda Commenting Our Code Variable Review Button Program – Add Textbox Getting text from textbox Converting text from textbox

Commenting Makes code easier to read Helps you to remember Single & Multi-line comments – // <- single line comment – /* multiline comment */ Be sure to comment your code!

Most Common C# Variable Types VariableUsage stringUse these for text intUse for whole numbers …, -2, -1, 0, 1, 2, … floatUse for scientific calculations decimalUsed for finances and percentages doubleDefault floating point number boolUsed for logical operations

Declaring Variables Many ways to do this: int age; // Most Common int age = 23; // Most Common int age; public int age; // We will learn more about private int age; // these examples later

Variable Assignment x = 1+2+3; The right hand side will be computed, then that value is assigned to x

Good Variable Names CamelCase – Capitalize the first letter of each word Long names are good Debate: To capitalize the first letter? – ALWAYS when it is a class – not always for variables

Math Operations Core 4: +, -, *, / Special: % (remainder after division) – What is -1%7? More math operations found in System.Math

Logic We can use a logic variable Or Compare 2 variables Compare Logic: – A and B, A or B, A xor B, A equal B – A && B, A || B, A ^ B, A == B Compare Numbers: – x y, x =y, x==y, x!=y Comparing Strings is Trickier

Let’s Make a Program Add a button – default name: button1 Add a textbox – default name: textBox1

Convert Class In our program we will use the class: Convert to convert from a string to a number. This can convert between many data types and is useful to know about. Usage (for Int32): x = Convert.ToInt32(inputString);

Try-Catch When don’t want our program to crash from a runtime error we can use Try-Catch Quickly create by typing try-”tab”-”tab” try { } catch (Exception ex) { mbox.Show(ex.Message()); }

If, Else if, Else double a, b, c; … if ( a>b) { // do something } else if ( a == b ) { // do something else } else { // if both above fail, do this }

Switch int age; … switch (age) { case 20: //do this if age == 20 break; case 25: // do this if age == 25 break; default: // do this if all the above cases fail break;