FEEG Applied Programming 5 - Tutorial Session
|
|
|
- Anna Stanley
- 10 years ago
- Views:
Transcription
1 FEEG Applied Programming 5 - Tutorial Session Sam Sinayoko / 38
2 Outline Objectives Two common bugs General comments on style String formatting Questions? Summary 2 / 38
3 Objectives Revise code submitted during labs Understand and fix two common bugs Improve style Review string formatting Anwer questions 4 / 38
4 For loop bug Example for(s=1;s<25; s = s++) { printf("month %2d: debt=%.2f, interest=%.2f, " "total_interest=%7.2f, frac=%6.2f%%\n", s, b*(pow(1.03,s)), 30*(pow(1.03,s-1)), (b*(pow(1.03,s)))-b, (b*(pow(1.03,s))-b)/10); 6 / 38
5 For loop bug The "s = s++" puzzle int s=0; s = s++; /* Does this print 0 or 1? */ printf("%d\n", s); 0 Understanding "s = s++" /* Initialize old value of s */ old_s = 0 /* Assign it to s */ s = old_s /* 0 */ /* Increment old value of s */ old_s = old_s + 1 /* 1 */ 7 / 38
6 For loop bug Solutions Use postfix increment "s++" without assignment for (s = 1; s < 25; s++) Use "+=1" for (s = 1; s < 25; s += 1) Use prefix increment "++s" with (or without) assignment for (s = 1; s < 25; s = ++s) 8 / 38
7 The division bug Example Adapted from lab 3. List 10 numbers between XMIN and XMAX. #define N 10 #define XMIN 1 #define XMAX 10 int main(void) { double x; int i; for (i = 0; i <= N-1; i = i + 1){ x = XMIN + (XMAX - XMIN)/(N - 1) * i; printf("%3.2f ", x); return 0; / 38
8 The division bug Same program with XMIN=2 #define N 10 #define XMIN 2 #define XMAX 10 int main(void) { double x; int i; for (i = 0; i <= N-1; i = i + 1){ x = XMIN + (XMAX - XMIN)/(N - 1) * i; printf("%3.2f ", x); return 0; / 38
9 The division bug The division problem int x = 3; printf("%0.3f", / x ); / 38
10 The division bug Solution Input at least one decimal number "1.0" int x = 3; printf("%0.3f", / x); -0.0 Remark 1: "1.0" is better than "1." Remark 2: not a robust solution. May break code later by mistakenly replacing 1.0 by an integer value. 12 / 38
11 The division bug Better solution Cast the denominator to a (double) (Defensive programming). int x = 3; printf("%0.3f", / (double) x); / 38
12 The division bug Modified code (fixed) From lab 3. List 10 numbers between XMIN and XMAX. #define N 10 #define XMIN 2 #define XMAX 10 int main(void) { double x, y, dx; int i; for (i = 0; i <= N-1; i = i + 1){ dx = (XMAX - XMIN) / ((double) (N - 1)); x = XMIN + dx * i; printf("%3.2f ", x); return 0; / 38
13 Indentation Bad indentation int main(void){ int Lower=-30; int Upper=30; int step=2; int Celsius; float Fahrenheit; for (Celsius=Lower; Celsius<Upper+step; Celsius=Celsius+ste Fahrenheit=Celsius*( (float) 9/5)+32; printf("%3d = %5.1f",Celsius,Fahrenheit); printf("\n"); 16 / 38
14 Indentation Good indentation int main(void) { int Lower=-30; int Upper=30; int step=2; int Celsius; float Fahrenheit; for (Celsius=Lower; Celsius<Upper+step; Celsius=Celsius Fahrenheit=Celsius*( (float) 9/5)+32; printf("%3d = %5.1f",Celsius,Fahrenheit); printf("\n"); 17 / 38
15 Position of curly brackets Kernighan and Ritchie style Open curly bracket on next line for function but on the same line for control structures. int main() { for (...) {... if (...) { / 38
16 Position of curly brackets NASA style int main() { for (...) {... if (...) { / 38
17 Capital letters Too many capital letters float INI; float FAH; for (INI = -30; INI<32; INI = INI +2) { FAH = ((INI*9)/5) + 32; printf("%3.0f = %5.1f\n",INI, FAH); Reserve capital letters for: global variables 1 (to make them stand out); matrices or multi-dimensional arrays (to follow the notation in maths); 1 usually declared with #define (e.g. "#define XMIN 0") 19 / 38
18 White space Too much vertical white space int main( void ){ float i; float T; for (i=-30; i<=30; i = i + 2) { T = i*(9/(float)5)+32; printf("%3.0f = %5.1f\n",i,T); return 0; 20 / 38
19 White space Better use of vertical white space int main(void) { float i; float T; for (i=-30; i<=30; i = i + 2) { T = i*(9/(float)5)+32; printf("%3.0f = %5.1f\n",i,T); return 0; Adding vertical white space is like creating a new paragraph in prose. Group meaningful elements together. 21 / 38
20 White space White space around brackets No space need for extra spaces around brackets (except closing one) for functions int main(void) {... Operators and brackets Use spaces around operators (* + - / % \= < > += etc). Not enough whitespace: T = i*(9/(float)5)+32; More readable: T = i * (9 / (float) 5 ) + 32; 22 / 38
21 White space tip for renaming variable Hard (for computer) to differentiate variables with similar names. Example It s hard to rename the variable interest to something else with "replace all" in a text editor, because we would modify total_interest too. x=interest*debt + total_interest If we generally have whitespace around variable "interest", we can simply 2 search for " interest " (note the spaces) x = interest * debt + total_interest 2 To handle brackets, as in "(interest" or "interest)", you can use regular expressions. 23 / 38
22 Declaring variables within a loop int main(void) { int celsius; for(celsius=-30; celsius<=30; celsius+=2) { float fahrenheit = celsius*9/5. +32; printf("%3d = %5.1f\n", celsius, fahrenheit); return 0; A bit wasteful: the variable is declared at every single iteration. 24 / 38
23 Declaring variables within a loop (fixed) Declare the variables outside the loop. int main(void) { int celsius; float fahrenheit; for(celsius = -30; celsius <= 30; celsius += 2) { fahrenheit = celsius * 9 / ; printf("%3d = %5.1f\n", celsius, fahrenheit); return 0; 25 / 38
24 Precedence rules "* % /" come before "+" and "-". Put brackets around everything else. Example from lab 2 Unnecessary brackets: F =( ( c*9)/5.) +32; More readable version: F = c * 9 / ; 26 / 38
25 Precedence rules Casting example int x = 1; int y = 2; printf("%0.1f, %0.1f, %0.1f", (double) x / y, /* precedence rule? */ ((double) x) / y, /* this? */ (double) (x / y) /* or that? */ ); 0.5, 0.5, 0.0 In this case, to avoid any confusion, it is OK to use additionnal brackets around the numerator. 27 / 38
26 Variable names (example with single letter variables) What do i, s, t, and f represent? Need to refer to comments. Hard to modify with search & replace int N, i; float s, debt, rate, in, t, f; N = 25; /* number of months */ s = 1000; /* starting debt */ debt = s; rate = 0.03; t = 0; /* total interest */ f = 0; /* fraction of total interest to original d for (i=1; i<n; i=i+1) { printf("month %3d: debt=%7.2f, interest=%4.2f, " "total_interest=%7.2f, frac=%6.2f%%\n", i, debt, in, t, f); 28 / 38
27 Variable names (improved variable names) int month, nbmonths; float loan, debt; float rate, interest, total_interest, frac; nbmonths = 25; /* loan duration in months */ loan = 1000; /* loan amount */ debt = loan; /* current debt */ rate = 0.03; /* interest rate */ tot_interest = 0; /* total interest payed so far */ frac = 0; /* total interest / loan */ for (month = 1; month < nbmonths; month++) {... printf("month %3d: debt=%7.2f, interest=%4.2f, " "total_interest=%7.2f, frac=%6.2f%%\n", month, debt, interest, tot_interest, frac); 29 / 38
28 String formatting syntax Syntax is %[flags][width][.precision][length]type Example: parsing format string "%07.3lf" flag 0 (padd with zeros) width 7 (total width is 7) precision.3 (precision is 2) length l (long ) type f (double) # Using printf command in unix shell printf "%07.3lf" / 38
29 String formatting: width Tip: to practise/test your understanding, add the zero flag to visualize spaces. format variable flag(s) width printf(format, variable) %02d %03d %04d / 38
30 String formatting: flags 0 use 0 instead of spaces to pad the result + prefix by + or - depending on the number sign space prefix by a space before positive numbers - left align (default is right align) Example with integers Exercise: give the flag(s) corresponding to the format and predict the output for the given variable. format x flag(s) printf(format, x) %04d 3 %04d -3 %+04d 3 %+04d -3 % 04d 3 %-04d 3 33 / 38
31 String formatting: flags 0 use 0 instead of spaces to pad the result + prefix by + or - depending on the number sign space prefix by a space before positive numbers - left align (default is right align) Example with integers Solution: format x flag(s) printf(format, x) comment %04d %04d %+04d %+04d % 04d one space + two zeros %-04d three spaces after 3 33 / 38
32 String formatting: precision format precision printf(format, M_PI) 3 comment %4.2f %4.3f output width 5 not 4 %5.5f output width 7 not 5 %09.5f %02.0f 0 03 displays float as int Precision supercedes width if width is too small 3 : built-in library "math.h" includes variable M_PI that represents π. 34 / 38
33 Length h l L... for short integers for long / double arguments long doubles 35 / 38
34 Summary For loop "s = s++" bug Use "s++" Use "s = ++s" Use "s += 1" The division bug n / 3 Use n / 3.0 Use (double) n / 3.0 Use good style good indentation proper use of white space well place curly brackets meaningful variable names 38 / 38
CP Lab 2: Writing programs for simple arithmetic problems
Computer Programming (CP) Lab 2, 2015/16 1 CP Lab 2: Writing programs for simple arithmetic problems Instructions The purpose of this Lab is to guide you through a series of simple programming problems,
The programming language C. sws1 1
The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan
The C Programming Language
Chapter 1 The C Programming Language In this chapter we will learn how to write simple computer programs using the C programming language; perform basic mathematical calculations; manage data stored in
Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C
Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection
Sources: On the Web: Slides will be available on:
C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,
Exercise 4 Learning Python language fundamentals
Exercise 4 Learning Python language fundamentals Work with numbers Python can be used as a powerful calculator. Practicing math calculations in Python will help you not only perform these tasks, but also
Introduction to Python
Caltech/LEAD Summer 2012 Computer Science Lecture 2: July 10, 2012 Introduction to Python The Python shell Outline Python as a calculator Arithmetic expressions Operator precedence Variables and assignment
CS 241 Data Organization Coding Standards
CS 241 Data Organization Coding Standards Brooke Chenoweth University of New Mexico Spring 2016 CS-241 Coding Standards All projects and labs must follow the great and hallowed CS-241 coding standards.
Install Java Development Kit (JDK) 1.8 http://www.oracle.com/technetwork/java/javase/downloads/index.html
CS 259: Data Structures with Java Hello World with the IntelliJ IDE Instructor: Joel Castellanos e-mail: joel.unm.edu Web: http://cs.unm.edu/~joel/ Office: Farris Engineering Center 319 8/19/2015 Install
An Incomplete C++ Primer. University of Wyoming MA 5310
An Incomplete C++ Primer University of Wyoming MA 5310 Professor Craig C. Douglas http://www.mgnet.org/~douglas/classes/na-sc/notes/c++primer.pdf C++ is a legacy programming language, as is other languages
ECE 341 Coding Standard
Page1 ECE 341 Coding Standard Professor Richard Wall University of Idaho Moscow, ID 83843-1023 [email protected] August 27, 2013 1. Motivation for Coding Standards The purpose of implementing a coding standard
CSCI 1301: Introduction to Computing and Programming Summer 2015 Project 1: Credit Card Pay Off
CSCI 1301: Introduction to Computing and Programming Summer 2015 Project 1: Credit Card Pay Off Introduction This project will allow you to apply your knowledge of variables, assignments, expressions,
Introduction to Python
WEEK ONE Introduction to Python Python is such a simple language to learn that we can throw away the manual and start with an example. Traditionally, the first program to write in any programming language
General Software Development Standards and Guidelines Version 3.5
NATIONAL WEATHER SERVICE OFFICE of HYDROLOGIC DEVELOPMENT Science Infusion Software Engineering Process Group (SISEPG) General Software Development Standards and Guidelines 7/30/2007 Revision History Date
PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON
PROBLEM SOLVING WITH SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON Addison Wesley Boston San Francisco New York London
Computational Mathematics with Python
Computational Mathematics with Python Basics Claus Führer, Jan Erik Solem, Olivier Verdier Spring 2010 Claus Führer, Jan Erik Solem, Olivier Verdier Computational Mathematics with Python Spring 2010 1
Computational Mathematics with Python
Boolean Arrays Classes Computational Mathematics with Python Basics Olivier Verdier and Claus Führer 2009-03-24 Olivier Verdier and Claus Führer Computational Mathematics with Python 2009-03-24 1 / 40
Beyond the Mouse A Short Course on Programming
1 / 22 Beyond the Mouse A Short Course on Programming 2. Fundamental Programming Principles I: Variables and Data Types Ronni Grapenthin Geophysical Institute, University of Alaska Fairbanks September
Computational Mathematics with Python
Numerical Analysis, Lund University, 2011 1 Computational Mathematics with Python Chapter 1: Basics Numerical Analysis, Lund University Claus Führer, Jan Erik Solem, Olivier Verdier, Tony Stillfjord Spring
Programming Languages CIS 443
Course Objectives Programming Languages CIS 443 0.1 Lexical analysis Syntax Semantics Functional programming Variable lifetime and scoping Parameter passing Object-oriented programming Continuations Exception
JDK 1.5 Updates for Introduction to Java Programming with SUN ONE Studio 4
JDK 1.5 Updates for Introduction to Java Programming with SUN ONE Studio 4 NOTE: SUN ONE Studio is almost identical with NetBeans. NetBeans is open source and can be downloaded from www.netbeans.org. I
How To Write A Programming Program
1 Preface... 6 Preface to the first edition...8 Chapter 1 - A Tutorial Introduction...9 1.1 Getting Started...9 1.2 Variables and Arithmetic Expressions...11 1.3 The for statement...15 1.4 Symbolic Constants...17
ESPResSo Summer School 2012
ESPResSo Summer School 2012 Introduction to Tcl Pedro A. Sánchez Institute for Computational Physics Allmandring 3 D-70569 Stuttgart Germany http://www.icp.uni-stuttgart.de 2/26 Outline History, Characteristics,
Introduction to Python
Introduction to Python Sophia Bethany Coban Problem Solving By Computer March 26, 2014 Introduction to Python Python is a general-purpose, high-level programming language. It offers readable codes, and
Vim, Emacs, and JUnit Testing. Audience: Students in CS 331 Written by: Kathleen Lockhart, CS Tutor
Vim, Emacs, and JUnit Testing Audience: Students in CS 331 Written by: Kathleen Lockhart, CS Tutor Overview Vim and Emacs are the two code editors available within the Dijkstra environment. While both
Informatica e Sistemi in Tempo Reale
Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)
Moving from CS 61A Scheme to CS 61B Java
Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you
Some Scanner Class Methods
Keyboard Input Scanner, Documentation, Style Java 5.0 has reasonable facilities for handling keyboard input. These facilities are provided by the Scanner class in the java.util package. A package is a
Example of a Java program
Example of a Java program class SomeNumbers static int square (int x) return x*x; public static void main (String[] args) int n=20; if (args.length > 0) // change default n = Integer.parseInt(args[0]);
We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.
LING115 Lecture Note Session #4 Python (1) 1. Introduction As we have seen in previous sessions, we can use Linux shell commands to do simple text processing. We now know, for example, how to count words.
Java Crash Course Part I
Java Crash Course Part I School of Business and Economics Institute of Information Systems HU-Berlin WS 2005 Sebastian Kolbe [email protected] Overview (Short) introduction to the environment Linux
Computer Science 1 CSci 1100 Lecture 3 Python Functions
Reading Computer Science 1 CSci 1100 Lecture 3 Python Functions Most of this is covered late Chapter 2 in Practical Programming and Chapter 3 of Think Python. Chapter 6 of Think Python goes into more detail,
C Coding Style Guide. Technotes, HowTo Series. 1 About the C# Coding Style Guide. 2 File Organization. Version 0.3. Contents
Technotes, HowTo Series C Coding Style Guide Version 0.3 by Mike Krüger, [email protected] Contents 1 About the C# Coding Style Guide. 1 2 File Organization 1 3 Indentation 2 4 Comments. 3 5 Declarations.
PRI-(BASIC2) Preliminary Reference Information Mod date 3. Jun. 2015
PRI-(BASIC2) Table of content Introduction...2 New Comment...2 Long variable...2 Function definition...3 Function declaration...3 Function return value...3 Keyword return inside functions...4 Function
Custom Javascript In Planning
A Hyperion White Paper Custom Javascript In Planning Creative ways to provide custom Web forms This paper describes several of the methods that can be used to tailor Hyperion Planning Web forms. Hyperion
Chapter 3. Input and output. 3.1 The System class
Chapter 3 Input and output The programs we ve looked at so far just display messages, which doesn t involve a lot of real computation. This chapter will show you how to read input from the keyboard, use
6.1. Example: A Tip Calculator 6-1
Chapter 6. Transition to Java Not all programming languages are created equal. Each is designed by its creator to achieve a particular purpose, which can range from highly focused languages designed for
Chapter 2 Elementary Programming
Chapter 2 Elementary Programming 2.1 Introduction You will learn elementary programming using Java primitive data types and related subjects, such as variables, constants, operators, expressions, and input
Chapter 13 Storage classes
Chapter 13 Storage classes 1. Storage classes 2. Storage Class auto 3. Storage Class extern 4. Storage Class static 5. Storage Class register 6. Global and Local Variables 7. Nested Blocks with the Same
The C Programming Language course syllabus associate level
TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming
Programmierpraktikum
Programmierpraktikum Claudius Gros, SS2012 Institut für theoretische Physik Goethe-University Frankfurt a.m. 1 of 21 10/16/2012 09:29 AM Java - A First Glance 2 of 21 10/16/2012 09:29 AM programming languages
Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language
Translation Translating to Java Introduction to Computer Programming The job of a programmer is to translate a problem description into a computer language. You need to be able to convert a problem description
Athena Knowledge Base
Athena Knowledge Base The Athena Visual Studio Knowledge Base contains a number of tips, suggestions and how to s that have been recommended by the users of the software. We will continue to enhance this
Introduction to Java
Introduction to Java The HelloWorld program Primitive data types Assignment and arithmetic operations User input Conditional statements Looping Arrays CSA0011 Matthew Xuereb 2008 1 Java Overview A high
CS1020 Data Structures and Algorithms I Lecture Note #1. Introduction to Java
CS1020 Data Structures and Algorithms I Lecture Note #1 Introduction to Java Objectives Java Basic Java features C Java Translate C programs in CS1010 into Java programs 2 References Chapter 1 Section
About The Tutorial. Audience. Prerequisites. Copyright & Disclaimer
About The Tutorial C is a general-purpose, procedural, imperative computer programming language developed in 1972 by Dennis M. Ritchie at the Bell Telephone Laboratories to develop the UNIX operating system.
Introduction to Java Applications. 2005 Pearson Education, Inc. All rights reserved.
1 2 Introduction to Java Applications 2.2 First Program in Java: Printing a Line of Text 2 Application Executes when you use the java command to launch the Java Virtual Machine (JVM) Sample program Displays
Computer Science 2nd Year Solved Exercise. Programs 3/4/2013. Aumir Shabbir Pakistan School & College Muscat. Important. Chapter # 3.
2013 Computer Science 2nd Year Solved Exercise Chapter # 3 Programs Chapter # 4 Chapter # 5 Chapter # 6 Chapter # 7 Important Work Sheets Aumir Shabbir Pakistan School & College Muscat 3/4/2013 Chap #
PL / SQL Basics. Chapter 3
PL / SQL Basics Chapter 3 PL / SQL Basics PL / SQL block Lexical units Variable declarations PL / SQL types Expressions and operators PL / SQL control structures PL / SQL style guide 2 PL / SQL Block Basic
Advanced Bash Scripting. Joshua Malone ([email protected])
Advanced Bash Scripting Joshua Malone ([email protected]) Why script in bash? You re probably already using it Great at managing external programs Powerful scripting language Portable and version-stable
Exercise 1: Python Language Basics
Exercise 1: Python Language Basics In this exercise we will cover the basic principles of the Python language. All languages have a standard set of functionality including the ability to comment code,
Lecture 5: Java Fundamentals III
Lecture 5: Java Fundamentals III School of Science and Technology The University of New England Trimester 2 2015 Lecture 5: Java Fundamentals III - Operators Reading: Finish reading Chapter 2 of the 2nd
MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.
Exam Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) The JDK command to compile a class in the file Test.java is A) java Test.java B) java
Sample CSE8A midterm Multiple Choice (circle one)
Sample midterm Multiple Choice (circle one) (2 pts) Evaluate the following Boolean expressions and indicate whether short-circuiting happened during evaluation: Assume variables with the following names
AWK: The Duct Tape of Computer Science Research. Tim Sherwood UC Santa Barbara
AWK: The Duct Tape of Computer Science Research Tim Sherwood UC Santa Barbara Duct Tape Systems Research Environment Lots of simulators, data, and analysis tools Since it is research, nothing works together
Eventia Log Parsing Editor 1.0 Administration Guide
Eventia Log Parsing Editor 1.0 Administration Guide Revised: November 28, 2007 In This Document Overview page 2 Installation and Supported Platforms page 4 Menus and Main Window page 5 Creating Parsing
Object Oriented Software Design II
Object Oriented Software Design II Introduction to C++ Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa February 20, 2012 G. Lipari (Scuola Superiore Sant Anna) C++ Intro February
Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas
CS 110B - Rule Storage Classes Page 18-1 Attributes are distinctive features of a variable. Data type, int or double for example, is an attribute. Storage class is another attribute. There are four storage
C Programming. Charudatt Kadolkar. IIT Guwahati. C Programming p.1/34
C Programming Charudatt Kadolkar IIT Guwahati C Programming p.1/34 We want to print a table of sine function. The output should look like: 0 0.0000 20 0.3420 40 0.6428 60 0.8660 80 0.9848 100 0.9848 120
How to Format a Bibliography or References List in the American University Thesis and Dissertation Template
PC Word 2010/2007 Bibliographies and References Lists Page 1 of 7 Click to Jump to a Topic How to Format a Bibliography or References List in the American University Thesis and Dissertation Template In
Assignment 2: Option Pricing and the Black-Scholes formula The University of British Columbia Science One CS 2015-2016 Instructor: Michael Gelbart
Assignment 2: Option Pricing and the Black-Scholes formula The University of British Columbia Science One CS 2015-2016 Instructor: Michael Gelbart Overview Due Thursday, November 12th at 11:59pm Last updated
Xcode User Default Reference. (Legacy)
Xcode User Default Reference (Legacy) Contents Introduction 5 Organization of This Document 5 Software Version 5 See Also 5 Xcode User Defaults 7 Xcode User Default Overview 7 General User Defaults 8 NSDragAndDropTextDelay
Formatting Numbers with C++ Output Streams
Formatting Numbers with C++ Output Streams David Kieras, EECS Dept., Univ. of Michigan Revised for EECS 381, Winter 2004. Using the output operator with C++ streams is generally easy as pie, with the only
5 Arrays and Pointers
5 Arrays and Pointers 5.1 One-dimensional arrays Arrays offer a convenient way to store and access blocks of data. Think of arrays as a sequential list that offers indexed access. For example, a list of
An Introduction to the WEB Style of Literate Programming
An Introduction to the WEB Style of Literate Programming Literate Programming by Bart Childs One of the greatest needs in computing is the reduction of the cost of maintenance of codes. Maintenance programmers
Topics. Parts of a Java Program. Topics (2) CS 146. Introduction To Computers And Java Chapter Objectives To understand:
Introduction to Programming and Algorithms Module 2 CS 146 Sam Houston State University Dr. Tim McGuire Introduction To Computers And Java Chapter Objectives To understand: the meaning and placement of
WAYNESBORO AREA SCHOOL DISTRICT CURRICULUM INTRODUCTION TO COMPUTER SCIENCE (June 2014)
UNIT: Programming with Karel NO. OF DAYS: ~18 KEY LEARNING(S): Focus on problem-solving and what it means to program. UNIT : How do I program Karel to do a specific task? Introduction to Programming with
CS 106 Introduction to Computer Science I
CS 106 Introduction to Computer Science I 01 / 21 / 2014 Instructor: Michael Eckmann Today s Topics Introduction Homework assignment Review the syllabus Review the policies on academic dishonesty and improper
Computer Programming I
Computer Programming I COP 2210 Syllabus Spring Semester 2012 Instructor: Greg Shaw Office: ECS 313 (Engineering and Computer Science Bldg) Office Hours: Tuesday: 2:50 4:50, 7:45 8:30 Thursday: 2:50 4:50,
IC4 Programmer s Manual
IC4 Programmer s Manual Charles Winton 2002 KISS Institute for Practical Robotics www.kipr.org This manual may be distributed and used at no cost as long as it is not modified. Corrections to the manual
Microsoft Windows PowerShell v2 For Administrators
Course 50414B: Microsoft Windows PowerShell v2 For Administrators Course Details Course Outline Module 1: Introduction to PowerShell the Basics This module explains how to install and configure PowerShell.
Object Oriented Software Design
Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 28, 2010 G. Lipari (Scuola Superiore Sant Anna) Introduction
AMATH 352 Lecture 3 MATLAB Tutorial Starting MATLAB Entering Variables
AMATH 352 Lecture 3 MATLAB Tutorial MATLAB (short for MATrix LABoratory) is a very useful piece of software for numerical analysis. It provides an environment for computation and the visualization. Learning
Field Properties Quick Reference
Field Properties Quick Reference Data types The following table provides a list of the available data types in Microsoft Office Access 2007, along with usage guidelines and storage capacities for each
Debugging Complex Macros
Debugging Complex Macros Peter Stagg, Decision Informatics It s possible to write code generated by macros to an external file. The file can t be access until the SAS session has ended. Use the options
A Python Tour: Just a Brief Introduction CS 303e: Elements of Computers and Programming
A Python Tour: Just a Brief Introduction CS 303e: Elements of Computers and Programming "The only way to learn a new programming language is by writing programs in it." -- B. Kernighan and D. Ritchie "Computers
Simulation Tools. Python for MATLAB Users I. Claus Führer. Automn 2009. Claus Führer Simulation Tools Automn 2009 1 / 65
Simulation Tools Python for MATLAB Users I Claus Führer Automn 2009 Claus Führer Simulation Tools Automn 2009 1 / 65 1 Preface 2 Python vs Other Languages 3 Examples and Demo 4 Python Basics Basic Operations
Modeling with Python
H Modeling with Python In this appendix a brief description of the Python programming language will be given plus a brief introduction to the Antimony reaction network format and libroadrunner. Python
Introduction to Matlab
Introduction to Matlab Social Science Research Lab American University, Washington, D.C. Web. www.american.edu/provost/ctrl/pclabs.cfm Tel. x3862 Email. [email protected] Course Objective This course provides
Chapter 3 Operators and Control Flow
Chapter 3 Operators and Control Flow I n this chapter, you will learn about operators, control flow statements, and the C# preprocessor. Operators provide syntax for performing different calculations or
C / C++ and Unix Programming. Materials adapted from Dan Hood and Dianna Xu
C / C++ and Unix Programming Materials adapted from Dan Hood and Dianna Xu 1 C and Unix Programming Today s goals ú History of C ú Basic types ú printf ú Arithmetic operations, types and casting ú Intro
CS1010 Programming Methodology A beginning in problem solving in Computer Science. Aaron Tan http://www.comp.nus.edu.sg/~cs1010/ 20 July 2015
CS1010 Programming Methodology A beginning in problem solving in Computer Science Aaron Tan http://www.comp.nus.edu.sg/~cs1010/ 20 July 2015 Announcements This document is available on the CS1010 website
Object Oriented Software Design
Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa September 14, 2011 G. Lipari (Scuola Superiore Sant Anna) Introduction
Introduction to Scientific Computing Part II: C and C++ C. David Sherrill School of Chemistry and Biochemistry Georgia Institute of Technology
Introduction to Scientific Computing Part II: C and C++ C. David Sherrill School of Chemistry and Biochemistry Georgia Institute of Technology The C Programming Language: Low-level operators Created by
Welcome to Introduction to programming in Python
Welcome to Introduction to programming in Python Suffolk One, Ipswich, 4:30 to 6:00 Tuesday Jan 14, Jan 21, Jan 28, Feb 11 Welcome Fire exits Toilets Refreshments 1 Learning objectives of the course An
A Comparison of C, MATLAB, and Python as Teaching Languages in Engineering
A Comparison of C, MATLAB, and Python as Teaching Languages in Engineering Hans Fangohr University of Southampton, Southampton SO17 1BJ, UK [email protected] Abstract. We describe and compare the programming
Introduction to Java. CS 3: Computer Programming in Java
Introduction to Java CS 3: Computer Programming in Java Objectives Begin with primitive data types Create a main class with helper methods Learn how to call built-in class methods and instance methods
AppendixA1A1. Java Language Coding Guidelines. A1.1 Introduction
AppendixA1A1 Java Language Coding Guidelines A1.1 Introduction This coding style guide is a simplified version of one that has been used with good success both in industrial practice and for college courses.
G563 Quantitative Paleontology. SQL databases. An introduction. Department of Geological Sciences Indiana University. (c) 2012, P.
SQL databases An introduction AMP: Apache, mysql, PHP This installations installs the Apache webserver, the PHP scripting language, and the mysql database on your computer: Apache: runs in the background
Java Program Coding Standards 4002-217-9 Programming for Information Technology
Java Program Coding Standards 4002-217-9 Programming for Information Technology Coding Standards: You are expected to follow the standards listed in this document when producing code for this class. Whether
1.00 Lecture 1. Course information Course staff (TA, instructor names on syllabus/faq): 2 instructors, 4 TAs, 2 Lab TAs, graders
1.00 Lecture 1 Course Overview Introduction to Java Reading for next time: Big Java: 1.1-1.7 Course information Course staff (TA, instructor names on syllabus/faq): 2 instructors, 4 TAs, 2 Lab TAs, graders
Decision Logic: if, if else, switch, Boolean conditions and variables
CS 1044 roject 3 Fall 2009 Decision Logic: if, if else, switch, Boolean conditions and variables This programming assignment uses many of the ideas presented in sections 3 through 5 of the Dale/Weems text
ECE 0142 Computer Organization. Lecture 3 Floating Point Representations
ECE 0142 Computer Organization Lecture 3 Floating Point Representations 1 Floating-point arithmetic We often incur floating-point programming. Floating point greatly simplifies working with large (e.g.,
AP Computer Science Java Subset
APPENDIX A AP Computer Science Java Subset The AP Java subset is intended to outline the features of Java that may appear on the AP Computer Science A Exam. The AP Java subset is NOT intended as an overall
Secrets of printf. 1 Background. 2 Simple Printing. Professor Don Colton. Brigham Young University Hawaii. 2.1 Naturally Special Characters
Secrets of Professor Don Colton Brigham Young University Hawaii is the C language function to do formatted printing. The same function is also available in PERL. This paper explains how works, and how
COMPUTER SCIENCE (5651) Test at a Glance
COMPUTER SCIENCE (5651) Test at a Glance Test Name Computer Science Test Code 5651 Time Number of Questions Test Delivery 3 hours 100 selected-response questions Computer delivered Content Categories Approximate
Data Tool Platform SQL Development Tools
Data Tool Platform SQL Development Tools ekapner Contents Setting SQL Development Preferences...5 Execution Plan View Options Preferences...5 General Preferences...5 Label Decorations Preferences...6
