CMPT 102 Introduction to Scientific Computer Programming

Size: px
Start display at page:

Download "CMPT 102 Introduction to Scientific Computer Programming"

Transcription

1 CMPT 102 Introduction to Scientific Computer Programming Examples of loops and nested loops Janice Regan, CMPT 102, Sept Problem Write a program to count the number of each of the following in a file containing text The vowels a, e, i, o, u, y All other characters (not vowels) except white space (tab, space, newline ) The user will enter the filename, and must be able to count vowels in multiple files without restarting the program Janice Regan, CMPT 102, Sept

2 Algorithm Your program should 1. Prompt the user for the name of the file containing the text 2. Open the file and read the characters from the file. The file can contain any number of characters in any number of lines.. 3. Count the number of each of the following vowels in the file a e i o u y 4. Count the number of other characters (excluding white space such as spaces and tabs) in the file 5. print the summary statistics 6. Prompt the user the see if the user wants to count the vowels in another file 7. If the user decides to count the vowels in another file return to 1. and continue, otherwise end the program execution. Janice Regan, CMPT 102, Sept Problem Statement You will be tabulating the data resulting from a field count of a particular type of bird. Each observer has provided the number of birds counted, and the area in acres of the observation region in which those birds were counted. You must determine the total number of birds counted, and the number of birds per acre. Janice Regan, CMPT 102, Sept

3 Problem Analysis Make the following assumptions: The coordinator of the experiment will be provided you with a file, surveydata.txt, containing the survey data after the survey is complete. The format of the data in that file is as follows The number of observers, numberobs, is an integer on the first line of the file. Following the first line in the file there is one line for each observer. On each of these lines is an integer, NumBirds, indicating the number of birds counted a double, AreaAcres, indicating the area of the observation region You may assume these two numbers are separated by a blank space. There is data for more than one observer. (numberobs>1) More information about the survey is included in the file following the lines of interest to you. Janice Regan, CMPT 102, Sept Designing an algorithm Your C program should complete each of the following tasks: Read an integer numberobs from the first line of file surveydata.txt Use a for loop to Read the next line of data from file input.txt. The number of birds is nbirds, and the area in acres is areaacres. Add the number of birds for this observer to the total number of birds, TNumBirds. Add the area for this observer to the total area, TArea. Determine the number of birds per acre, birdsperacre. Print the total number of birds and the number of birds per acre on separate lines. Each line should include an explanation of what the printed number represents. Janice Regan, CMPT 102, Sept

4 Problem Statement Altitude and velocity data has been collected for a weather balloon. Write a program to print a table of altitude in meters and velocity in meters per second as at 10 minute intervals for a two hour period starting 4 hours after the launch of the weather balloon. Also determine the balloons maximum altitude during the period covered by the table. Based on problem 4.43 Etter(2005) Janice Regan, CMPT 102, Sept Problem Analysis Background Weather balloons are used to gather pressure and temperature information at various altitudes in the atmosphere. The balloon rises when the helium inside is less dense than the surrounding air. When the balloon is warmed by the sun the helium expands (becomes less dense) and the balloon rises. When the sun sets the balloon cools and the helium contracts (becomes more dense) and the balloon s altitude decreases. At given intervals measurements of altitude, velocity, and temperature are made. Janice Regan, CMPT 102, Sept

5 Problem analysis assumptions Measurements were taken over the first 48 hours of the flight of a weather balloon. The data gathered were approximated by polynomials ( a polynomial that produced a line that fit the data well was found) Altitude alt(t) = -0.12t t 3-380t t Velocity v(t) = -0.48t 3-36t t Janice Regan, CMPT 102, Sept Problem Analysis What do we know The polynomials The interval between successive interpolated results (the value we would expect to see at that time based on our observed data which may be at times before and after the time of interest) The start and end time of observations to be included in the table (should start no earlier than the launch of the balloon and end no later than 48 hours after the launch when out data ends) Janice Regan, CMPT 102, Sept

6 Program Analysis Inputs Starting time Time increment Ending time NOTE: polynomials will be hard coded in the program, this program will be useful only for this set of data Outputs A table showing the altitude and velocity at n minute intervals starting k minutes after launch and ending l minutes after launch The maximum altitude reached by the balloon Janice Regan, CMPT 102, Sept Designing an Algorithm Read Inputs (start time, end time, interval) Verify data (check start time < end time, start time and end time both < 48 hrs, interval < 48 hrs ) this step is omitted in the sample program Print a title for the table (Weather Balloon Data) Print headings for the columns in the table (Time Height Velocity) Initialize the maximum altitude to 0 Initialize time of maximum altitude to start time For each time (each row in the table) Evaluate the alt(t) to get the height Evaluate the v(t) to get the velocity Print a row in the table (time height velocity) Check to see if the altitude is larger than the maximum altitude If it is update the maximum altitude to be the altitude for the present time and update the time of maximum altitude to be the present time Print the maximum altitude and the time that it occurred Janice Regan, CMPT 102, Sept

7 Left to do Modify the sample program so that the input values are checked for consistency and correctness Janice Regan, CMPT 102, Sept Problem Statement Calculate how many ways you can choose r objects from n different objects. You should build your program using reusable functions for factorial and combinations. Janice Regan, CMPT 102, Sept

8 n! r!( n r )! Analysis Need to write two functions, begin by declaring the prototypes int factorial( int n ); Calculates n! n*(n-1)*(n-2)* *2*1 intcombination( intn, intr ); Calculates how many ways r objects can be chosen from m objects n! r!( n r)! The number of combinations (the number of ways r objects can be chosen from m objects) is calculated using the formula. Write the Factorial function Janice Regan, CMPT 102, Sept Function to compute a factorial int factorial( int n) /* declare local variables */ int i; int product; /* initialize local variables */ product = 1; for (i = n; i >1; i--) product *= i; return (product); Janice Regan, CMPT 102, Sept

9 Is this a useful factorial function? In this program the return value is an integer This makes sense since the value of n! is an integer However, the largest integer that can be represented using an int is For what value of n does n! exceed (13) This function will only work for values up to 12 For a more generally useful factorial function we could make the return value a floating point number. (see alternate code provided) Janice Regan, CMPT 102, Sept Function to compute a factorial double factorial( int n) /* declare local variables */ int i; double product; /* initialize local variables */ product = 1; for (i = n; i >1; i--) product *= i; return (product); Janice Regan, CMPT 102, Sept

10 combination function double combination(int n, int r ) j if(r <= n && n >=0) return( factorial(n) / (factorial(r) * factorial(n-r)) ); else return( -1 ); Janice Regan, CMPT 102, Sept

CMPT 102 Introduction to Scientific Computer Programming. Input and Output. Your first program

CMPT 102 Introduction to Scientific Computer Programming. Input and Output. Your first program CMPT 102 Introduction to Scientific Computer Programming Input and Output Janice Regan, CMPT 102, Sept. 2006 0 Your first program /* My first C program */ /* make the computer print the string Hello world

More information

Structured Programming. Flowchart Symbols. Structured Programming. Selection. Sequence. Control Structures ELEC 330 1

Structured Programming. Flowchart Symbols. Structured Programming. Selection. Sequence. Control Structures ELEC 330 1 ELEC 330 1 Structured Programming Control Structures ELEC 206 Computer Applications for Electrical Engineers Dr. Ron Hayne Algorithm Development Conditional Expressions Selection Statements Loops 206_C3

More information

CMPT 102 Introduction to Scientific Computer Programming

CMPT 102 Introduction to Scientific Computer Programming CMPT 102 Introduction to Scientific Computer Programming Control Structures for Loops Janice Regan, CMPT 102, Sept. 2006 0 Control Structures Three methods of processing a program In sequence Branching

More information

CMPT 102 Introduction to Scientific Computer Programming

CMPT 102 Introduction to Scientific Computer Programming CMPT 12 Introduction to Scientific Computer Programming Introduction to Arrays Janice Regan, CMPT 12, Sept. 26 Simple and Composite Variables We have studied simple variables A simple variable describes

More information

SAMPLE MIDTERM SOLUTION

SAMPLE MIDTERM SOLUTION CMPT 102 SAMPLE MIDTERM SOLUTION PART 1 (40 points): SHORT ANSWER QUESTIONS 1. (8 points) Which of the following identifiers are invalid? Why? int my_book while loop FOR butter iff sentinel Calc-mean MeanOf45

More information

Survey Design, Distribution & Analysis Software. professional quest. Whitepaper Extracting Data into Microsoft Excel

Survey Design, Distribution & Analysis Software. professional quest. Whitepaper Extracting Data into Microsoft Excel Survey Design, Distribution & Analysis Software professional quest Whitepaper Extracting Data into Microsoft Excel WHITEPAPER Extracting Scoring Data into Microsoft Excel INTRODUCTION... 1 KEY FEATURES

More information

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible)

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible) Name Closed notes, book and neighbor. If you have any questions ask them. Notes: Segment of code necessary C++ statements to perform the action described not a complete program Program a complete C++ program

More information

ENGINEERING PROBLEM SOLVING WITH C++

ENGINEERING PROBLEM SOLVING WITH C++ ENGINEERING PROBLEM SOLVING WITH C++ Second Edition Delores M. Etter Electrical Engineering Department United States Naval Academy Jeanine A. Ingber Training Consultant Sandia National Laboratories Upper

More information

ECE 190 Midterm Exam 3 Spring 2011

ECE 190 Midterm Exam 3 Spring 2011 ECE 190 Midterm Exam 3 Spring 2011 Practice Exam Notes: This exam will consist entirely of five programming problems. Each problem will be graded separately. We will provide skeleton codes for each problem.

More information

Outline chapter 4 control structures: REPETITION READ/STUDY SEC 4.1 TO 4.6

Outline chapter 4 control structures: REPETITION READ/STUDY SEC 4.1 TO 4.6 Outline chapter 4 control structures: REPETITION READ/STUDY SEC 4.1 TO 4.6 STUDY AND PRACTICE WITH CODING NEWBIE VIDEO 12 FOR loops 13 WHILE loops 14 DO WHILE loops in this order: The text covers While

More information

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible)

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible) Name Closed notes, book and neighbor. If you have any questions ask them. Notes: Segment of code necessary C++ statements to perform the action described not a complete program Program a complete C++ program

More information

Scheme G. Sample Test Paper-I. Course Name : Computer Engineering Group Course Code : CO/CD/CM/CW/IF Semester : Second Subject Tile : Programming in C

Scheme G. Sample Test Paper-I. Course Name : Computer Engineering Group Course Code : CO/CD/CM/CW/IF Semester : Second Subject Tile : Programming in C Sample Test Paper-I Marks : 25 Time:1 Hrs. Q1. Attempt any THREE 09 Marks a) State four relational operators with meaning. b) State the use of break statement. c) What is constant? Give any two examples.

More information

Multiple Choice (Questions 1 14) 28 Points Select all correct answers (multiple correct answers are possible)

Multiple Choice (Questions 1 14) 28 Points Select all correct answers (multiple correct answers are possible) Name Closed notes, book and neighbor. If you have any questions ask them. Notes: Segment of code necessary C++ statements to perform the action described not a complete program Program a complete C++ program

More information

ZLog Z6R Altitude Data Recording and Monitoring System

ZLog Z6R Altitude Data Recording and Monitoring System ZLog Z6R Altitude Data Recording and Monitoring System 2014-04-28 Page 1 of 24 Introduction ZLog was designed to provide a lightweight, compact device for measuring and recording altitude over time. It

More information

CPE 112 Spring 2015 Exam II (100 pts) March 4, Definition Matching (8 Points)

CPE 112 Spring 2015 Exam II (100 pts) March 4, Definition Matching (8 Points) Name Definition Matching (8 Points) 1. (8 pts) Match the words with their definitions. Choose the best definition for each word. Relational Expression Iteration Counter Count-controlled loop Loop Flow

More information

Since a projectile moves in 2-dimensions, it therefore has 2 components just like a resultant vector: Horizontal Vertical

Since a projectile moves in 2-dimensions, it therefore has 2 components just like a resultant vector: Horizontal Vertical Since a projectile moves in 2-dimensions, it therefore has 2 components just like a resultant vector: Horizontal Vertical With no gravity the projectile would follow the straight-line path (dashed line).

More information

Name Section: M/W T/TH Number Definition Matching (6 Points)

Name Section: M/W T/TH Number Definition Matching (6 Points) Name Section: M/W T/TH Number Definition Matching (6 Points) 1. (6 pts) Match the words with their definitions. Choose the best definition for each word. Event Counter Iteration Counter Loop Flow of Control

More information

Introduction to C/C++ Programming

Introduction to C/C++ Programming Chapter 1 Introduction to C/C++ Programming This book is about learning numerical programming skill and the software development process. Therefore, it requires a lot of hands-on programming exercises.

More information

Driftsonde System Overview

Driftsonde System Overview Driftsonde System Overview Zero-pressure Balloon Gondola (24 sonde capacity) 6 hours between drops Terry Hock, Hal Cole, Charlie Martin National Center for Atmospheric Research Earth Observing Lab December

More information

DINO. Language Reference Manual. Author: Manu Jain

DINO. Language Reference Manual. Author: Manu Jain DINO Language Reference Manual Author: Manu Jain Table of Contents TABLE OF CONTENTS...2 1. INTRODUCTION...3 2. LEXICAL CONVENTIONS...3 2.1. TOKENS...3 2.2. COMMENTS...3 2.3. IDENTIFIERS...3 2.4. KEYWORDS...3

More information

Name Section: M/W T/TH Number Definition Matching (8 Points)

Name Section: M/W T/TH Number Definition Matching (8 Points) Name Section: M/W T/TH Number Definition Matching (8 Points) 1. (8 pts) Match the words with their definitions. Choose the best definition for each word. Iteration Counter Event Counter Loop Abstract Step

More information

INDIAN SCHOOL MUSCAT COMPUTER SCIENCE(083) CLASS XI

INDIAN SCHOOL MUSCAT COMPUTER SCIENCE(083) CLASS XI INDIAN SCHOOL MUSCAT COMPUTER SCIENCE(083) CLASS XI 2017-2018 Worksheet No. 1 Topic : Getting Started With C++ 1. Write a program to generate the following output: Year Profit% 2011 18 2012 27 2013 32

More information

Faculty of Engineering Computer Engineering Department Islamic University of Gaza C++ Programming Language Lab # 6 Functions

Faculty of Engineering Computer Engineering Department Islamic University of Gaza C++ Programming Language Lab # 6 Functions Faculty of Engineering Computer Engineering Department Islamic University of Gaza 2013 C++ Programming Language Lab # 6 Functions C++ Programming Language Lab # 6 Functions Objective: To be familiar with

More information

Export Desktop Motion Analyzer profiles to Motion Analyzer Online: SolidWorks Motion Study Move Profile

Export Desktop Motion Analyzer profiles to Motion Analyzer Online: SolidWorks Motion Study Move Profile Export Desktop Motion Analyzer profiles to Motion Analyzer Online: SolidWorks Motion Study Move Profile For: Motion profiles with simple or static loads Splits motion profile into user defined number of

More information

Introduction to Computer Science Midterm 3 Fall, Points

Introduction to Computer Science Midterm 3 Fall, Points Introduction to Computer Science Fall, 2001 100 Points Notes 1. Tear off this sheet and use it to keep your answers covered at all times. 2. Turn the exam over and write your name next to the staple. Do

More information

Course Outline. Introduction to java

Course Outline. Introduction to java Course Outline 1. Introduction to OO programming 2. Language Basics Syntax and Semantics 3. Algorithms, stepwise refinements. 4. Quiz/Assignment ( 5. Repetitions (for loops) 6. Writing simple classes 7.

More information

CS16 Exam #1 7/17/ Minutes 100 Points total

CS16 Exam #1 7/17/ Minutes 100 Points total CS16 Exam #1 7/17/2012 75 Minutes 100 Points total Name: 1. (10 pts) Write the definition of a C function that takes two integers `a` and `b` as input parameters. The function returns an integer holding

More information

Chapter 5. Repetition. Contents. Introduction. Three Types of Program Control. Two Types of Repetition. Three Syntax Structures for Looping in C++

Chapter 5. Repetition. Contents. Introduction. Three Types of Program Control. Two Types of Repetition. Three Syntax Structures for Looping in C++ Repetition Contents 1 Repetition 1.1 Introduction 1.2 Three Types of Program Control Chapter 5 Introduction 1.3 Two Types of Repetition 1.4 Three Structures for Looping in C++ 1.5 The while Control Structure

More information

Multiple Choice (Questions 1 14) 28 Points Select all correct answers (multiple correct answers are possible)

Multiple Choice (Questions 1 14) 28 Points Select all correct answers (multiple correct answers are possible) Name Closed notes, book and neighbor. If you have any questions ask them. Notes: Segment of code necessary C++ statements to perform the action described not a complete program Program a complete C++ program

More information

C Language Part 1 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee

C Language Part 1 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee C Language Part 1 (Minor modifications by the instructor) References C for Python Programmers, by Carl Burch, 2011. http://www.toves.org/books/cpy/ The C Programming Language. 2nd ed., Kernighan, Brian,

More information

Department of Mathematical Sciences, FAU. Instructions:

Department of Mathematical Sciences, FAU. Instructions: Instructions: * This is a computer-based assignment (Total points: 8). Please write your code that runs in Python. (1) Submission: Your codes/programs must be submitted electronically by email to sbai@fau.edu

More information

Euclid s algorithm, 133

Euclid s algorithm, 133 Index A Algorithm computer instructions, 4 data and variables, 5 develop algorithm, 6 American Standard Code for Information Interchange (ASCII) codes, 141 definition, 142 features, 142 Arithmetic expressions

More information

UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA C ASSIGNMENTS

UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA C ASSIGNMENTS UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA C ASSIGNMENTS All programs need to be submitted on 7th Oct 206 by writing in hand written format in A4 sheet. Flowcharts, algorithms, source codes and outputs

More information

Chapter 4: Basic C Operators

Chapter 4: Basic C Operators Chapter 4: Basic C Operators In this chapter, you will learn about: Arithmetic operators Unary operators Binary operators Assignment operators Equalities and relational operators Logical operators Conditional

More information

Unit 2 Day 6. Characteristics Of Quadratic, Even, And Odd Functions

Unit 2 Day 6. Characteristics Of Quadratic, Even, And Odd Functions Unit 2 Day 6 Characteristics Of Quadratic, Even, And Odd Functions 1 Warm Up 1.) Jenna is trying to invest money into the stock exchange. After some research, she has narrowed it down to two companies.

More information

Application of TileFlow to Improve Cooling in a Data Center

Application of TileFlow to Improve Cooling in a Data Center Case Study Application of TileFlow to Improve Cooling in a Data Center 3025 Harbor Lane North, Suite 300 Plymouth, MN 55447 USA Copyright 2004 Innovative Research, Inc. 2 Introduction A large insurance

More information

LAB 2.1 INTRODUCTION TO C PROGRAMMING

LAB 2.1 INTRODUCTION TO C PROGRAMMING LAB 2.1 INTRODUCTION TO C PROGRAMMING School of Computer and Communication Engineering Universiti Malaysia Perlis 1 1. OBJECTIVES: 1.1 To be able to apply basic rules and structures of C in writing a simple

More information

Chapter 4 Introduction to Control Statements

Chapter 4 Introduction to Control Statements Introduction to Control Statements Fundamentals of Java: AP Computer Science Essentials, 4th Edition 1 Objectives 2 How do you use the increment and decrement operators? What are the standard math methods?

More information

ESCI 386 IDL Programming for Advanced Earth Science Applications Lesson 7 Input/Output

ESCI 386 IDL Programming for Advanced Earth Science Applications Lesson 7 Input/Output ESCI 386 IDL Programming for Advanced Earth Science Applications Lesson 7 Input/Output Reading: Bowman, Chapters 10-12 READING FROM THE TERMINAL The READ procedure is used to read from the terminal. IDL

More information

Quadratic Functions, Part 1

Quadratic Functions, Part 1 Quadratic Functions, Part 1 A2.F.BF.A.1 Write a function that describes a relationship between two quantities. A2.F.BF.A.1a Determine an explicit expression, a recursive process, or steps for calculation

More information

Liquid and Gas Ultrasonic Flowmeters Smith Meter Ultra 4c, 6c, and 8c MPU 200c, 600c, 800c, and 1600c

Liquid and Gas Ultrasonic Flowmeters Smith Meter Ultra 4c, 6c, and 8c MPU 200c, 600c, 800c, and 1600c Liquid and Gas Ultrasonic Flowmeters Smith Meter Ultra 4c, 6c, and 8c MPU 200c, 600c, 800c, and 1600c External Data Communications Manual Bulletin MN0A003 Issue/Rev 0.0 (4/16) Important All information

More information

1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol.

1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol. 1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol. B. Outputs to the console a floating point number f1 in scientific format

More information

CPE Summer 2015 Exam I (150 pts) June 18, 2015

CPE Summer 2015 Exam I (150 pts) June 18, 2015 Name Closed notes and book. If you have any questions ask them. Write clearly and make sure the case of a letter is clear (where applicable) since C++ is case sensitive. You can assume that there is one

More information

HIGH TEMPERATURE / FOOD PASTEURIZATION LOGGER

HIGH TEMPERATURE / FOOD PASTEURIZATION LOGGER E S C O R T HIGH TEMPERATURE / FOOD PASTEURIZATION LOGGER U S E R M A N U A L Contents 1. Getting Started... 3 2. Installing Console Pro Software... 3 3. Installing USB Drivers... 5 4. Programming the

More information

C Language, Token, Keywords, Constant, variable

C Language, Token, Keywords, Constant, variable C Language, Token, Keywords, Constant, variable A language written by Brian Kernighan and Dennis Ritchie. This was to be the language that UNIX was written in to become the first "portable" language. C

More information

Week 0. Net Salary =Earnings- deductions; Read the employee number, Basic Print employee Number, Earnings,Deductions and Net salary.

Week 0. Net Salary =Earnings- deductions; Read the employee number, Basic Print employee Number, Earnings,Deductions and Net salary. Week 0. 1. Write a C program that evaluate the following expressions. Assume suitable values for various variables and print the left hand side variable. a) D=ut+1/2 ut 2 b) B=a*e kt c) P=RT/v d) Val=ax

More information

o Counter and sentinel controlled loops o Formatting output o Type casting o Top-down, stepwise refinement

o Counter and sentinel controlled loops o Formatting output o Type casting o Top-down, stepwise refinement Last Time Let s all Repeat Together 10/3/05 CS150 Introduction to Computer Science 1 1 We covered o Counter and sentinel controlled loops o Formatting output Today we will o Type casting o Top-down, stepwise

More information

CpSc 101, Fall 2015 Lab7: Image File Creation

CpSc 101, Fall 2015 Lab7: Image File Creation CpSc 101, Fall 2015 Lab7: Image File Creation Goals Construct a C language program that will produce images of the flags of Poland, Netherland, and Italy. Image files Images (e.g. digital photos) consist

More information

Module 4: Fluid Dynamics Lecture 9: Lagrangian and Eulerian approaches; Euler's acceleration formula. Fluid Dynamics: description of fluid-motion

Module 4: Fluid Dynamics Lecture 9: Lagrangian and Eulerian approaches; Euler's acceleration formula. Fluid Dynamics: description of fluid-motion Fluid Dynamics: description of fluid-motion Lagrangian approach Eulerian approach (a field approach) file:///d /Web%20Course/Dr.%20Nishith%20Verma/local%20server/fluid_mechanics/lecture9/9_1.htm[5/9/2012

More information

ANSI C Programming Simple Programs

ANSI C Programming Simple Programs ANSI C Programming Simple Programs /* This program computes the distance between two points */ #include #include #include main() { /* Declare and initialize variables */ double

More information

Programming. We will be introducing various new elements of Python and using them to solve increasingly interesting and complex problems.

Programming. We will be introducing various new elements of Python and using them to solve increasingly interesting and complex problems. Plan for the rest of the semester: Programming We will be introducing various new elements of Python and using them to solve increasingly interesting and complex problems. We saw earlier that computers

More information

COMP 110 Project 1 Programming Project Warm-Up Exercise

COMP 110 Project 1 Programming Project Warm-Up Exercise COMP 110 Project 1 Programming Project Warm-Up Exercise Creating Java Source Files Over the semester, several text editors will be suggested for students to try out. Initially, I suggest you use JGrasp,

More information

ARRAY VARIABLES (ROW VECTORS)

ARRAY VARIABLES (ROW VECTORS) 11 ARRAY VARIABLES (ROW VECTORS) % Variables in addition to being singular valued can be set up as AN ARRAY of numbers. If we have an array variable as a row of numbers we call it a ROW VECTOR. You can

More information

Programming in C++ 4. The lexical basis of C++

Programming in C++ 4. The lexical basis of C++ Programming in C++ 4. The lexical basis of C++! Characters and tokens! Permissible characters! Comments & white spaces! Identifiers! Keywords! Constants! Operators! Summary 1 Characters and tokens A C++

More information

Using DataQuest on a Handheld

Using DataQuest on a Handheld Using DataQuest on a Handheld Appendix B This appendix gives an overview of using the Vernier DataQuest application on a TI-Nspire handheld. It includes information on accessing the common tools in the

More information

[Page 177 (continued)] a. if ( age >= 65 ); cout << "Age is greater than or equal to 65" << endl; else cout << "Age is less than 65 << endl";

[Page 177 (continued)] a. if ( age >= 65 ); cout << Age is greater than or equal to 65 << endl; else cout << Age is less than 65 << endl; Page 1 of 10 [Page 177 (continued)] Exercises 4.11 Identify and correct the error(s) in each of the following: a. if ( age >= 65 ); cout

More information

Implementing Subprograms

Implementing Subprograms 1 Implementing Subprograms CS 315 Programming Languages Pinar Duygulu Bilkent University CS315 Programming Languages Pinar Duygulu The General Semantics of Calls and Returns 2 The subprogram call and return

More information

In this session we will cover the following sub-topics: 1.Identifiers 2.Variables 3.Keywords 4.Statements 5.Comments 6.Whitespaces 7.Syntax 8.

In this session we will cover the following sub-topics: 1.Identifiers 2.Variables 3.Keywords 4.Statements 5.Comments 6.Whitespaces 7.Syntax 8. In this session we will cover the following sub-topics: 1.Identifiers 2.Variables 3.Keywords 4.Statements 5.Comments 6.Whitespaces 7.Syntax 8.Semantic www.tenouk.com, 1/16 C IDENTIFIERS 1. Is a unique

More information

CHAPTER 4 FUNCTIONS. Dr. Shady Yehia Elmashad

CHAPTER 4 FUNCTIONS. Dr. Shady Yehia Elmashad CHAPTER 4 FUNCTIONS Dr. Shady Yehia Elmashad Outline 1. Introduction 2. Program Components in C++ 3. Math Library Functions 4. Functions 5. Function Definitions 6. Function Prototypes 7. Header Files 8.

More information

An Introduction to MATLAB

An Introduction to MATLAB An Introduction to MATLAB Day 1 Simon Mitchell Simon.Mitchell@ucla.edu High level language Programing language and development environment Built-in development tools Numerical manipulation Plotting of

More information

Work with External Data in SPSS or Excel Format - Open SPSS data

Work with External Data in SPSS or Excel Format - Open SPSS data Work with External Data in SPSS or Excel Format - Open SPSS data Contents WORK WITH EXTERNAL DATA IN SPSS OR EXCEL FORMAT - OPEN SPSS DATA... 1 Open an Excel file... 1 Create new External File... 2 Save

More information

Modeling and Prototypes

Modeling and Prototypes Modeling and Prototypes 4.4.1 Unit 4, Lesson 4 Explanation The Unit Big Idea The Engineering Design process is a systematic, iterative problem solving method which produces solutions to meet human wants

More information

Programming Fundamentals for Engineers Functions. Muntaser Abulafi Yacoub Sabatin Omar Qaraeen. Modular programming.

Programming Fundamentals for Engineers Functions. Muntaser Abulafi Yacoub Sabatin Omar Qaraeen. Modular programming. Programming Fundamentals for Engineers - 0702113 7. Functions Muntaser Abulafi Yacoub Sabatin Omar Qaraeen 1 Modular programming Your program main() function Calls AnotherFunction1() Returns the results

More information

! A literal represents a constant value used in a. ! Numbers: 0, 34, , -1.8e12, etc. ! Characters: 'A', 'z', '!', '5', etc.

! A literal represents a constant value used in a. ! Numbers: 0, 34, , -1.8e12, etc. ! Characters: 'A', 'z', '!', '5', etc. Week 1: Introduction to C++ Gaddis: Chapter 2 (excluding 2.1, 2.11, 2.14) CS 1428 Fall 2014 Jill Seaman Literals A literal represents a constant value used in a program statement. Numbers: 0, 34, 3.14159,

More information

(Capstone-High Altitude Balloon) EE 476

(Capstone-High Altitude Balloon) EE 476 CAP-HAB (Capstone-High Altitude Balloon) EE 476 Jad Lutfi Andrew Prosory Rob Hough Rob Conant Rob Hough High Altitude Research Balloon Overview Project Overview Problem Statement System Diagram Design

More information

Questions Bank. 14) State any four advantages of using flow-chart

Questions Bank. 14) State any four advantages of using flow-chart Questions Bank Sub:PIC(22228) Course Code:-EJ-2I ----------------------------------------------------------------------------------------------- Chapter:-1 (Overview of C Programming)(10 Marks) 1) State

More information

Lesson 3.1 Vertices and Intercepts. Important Features of Parabolas

Lesson 3.1 Vertices and Intercepts. Important Features of Parabolas Lesson 3.1 Vertices and Intercepts Name: _ Learning Objective: Students will be able to identify the vertex and intercepts of a parabola from its equation. CCSS.MATH.CONTENT.HSF.IF.C.7.A Graph linear and

More information

Reviewing Hidden Content during Native Review

Reviewing Hidden Content during Native Review Reviewing Hidden Content during Native Review Introduction When conducting a native file review it is important to note that certain files can have hidden content. These are features of certain software

More information

Conditionals. For exercises 1 to 27, indicate the output that will be produced. Assume the following declarations:

Conditionals. For exercises 1 to 27, indicate the output that will be produced. Assume the following declarations: Conditionals For exercises 1 to 27, indicate the output that will be produced. Assume the following declarations: final int MAX = 25, LIMIT = 100; int num1 = 12, num2 = 25, num3 = 87; 1. if (num1 < MAX)

More information

Chapter 8 Arrays and Strings. Objectives. Objectives (cont d.) Introduction. Arrays 12/23/2016. In this chapter, you will:

Chapter 8 Arrays and Strings. Objectives. Objectives (cont d.) Introduction. Arrays 12/23/2016. In this chapter, you will: Chapter 8 Arrays and Strings Objectives In this chapter, you will: Learn about arrays Declare and manipulate data into arrays Learn about array index out of bounds Learn about the restrictions on array

More information

Install and Configure the TS Agent

Install and Configure the TS Agent Install the TS Agent, page 1 Start the TS Agent Configuration Interface, page 2 Configure the TS Agent, page 2 Creating the REST VDI Role, page 7 Install the TS Agent Before You Begin Confirm that the

More information

COP 3223 Introduction to Programming with C - Study Union - Fall 2017

COP 3223 Introduction to Programming with C - Study Union - Fall 2017 COP 3223 Introduction to Programming with C - Study Union - Fall 2017 Chris Marsh and Matthew Villegas Contents 1 Code Tracing 2 2 Pass by Value Functions 4 3 Statically Allocated Arrays 5 3.1 One Dimensional.................................

More information

CS302: Self Check Quiz 2

CS302: Self Check Quiz 2 CS302: Self Check Quiz 2 name: Part I True or False For these questions, is the statement true or false? Assume the statements are about the Java programming language. 1.) The result of an expression with

More information

fpp: Fortran preprocessor March 9, 2009

fpp: Fortran preprocessor March 9, 2009 fpp: Fortran preprocessor March 9, 2009 1 Name fpp the Fortran language preprocessor for the NAG Fortran compiler. 2 Usage fpp [option]... [input-file [output-file]] 3 Description fpp is the preprocessor

More information

ANP Data Verification and Validation

ANP Data Verification and Validation ANP Data Verification and Validation JRC Workshop 19-20 January Brussels Laurent Cavadini The European Organisation for the Safety of Air Navigation ANP Data - Contents and Formats Aircraft table Jet engine

More information

Unit 7. Functions. Need of User Defined Functions

Unit 7. Functions. Need of User Defined Functions Unit 7 Functions Functions are the building blocks where every program activity occurs. They are self contained program segments that carry out some specific, well defined task. Every C program must have

More information

COP 3223 Introduction to Programming with C - Study Union - Fall 2017

COP 3223 Introduction to Programming with C - Study Union - Fall 2017 COP 3223 Introduction to Programming with C - Study Union - Fall 2017 Chris Marsh and Matthew Villegas Contents 1 Code Tracing 2 2 Pass by Value Functions 4 3 Statically Allocated Arrays 5 3.1 One Dimensional.................................

More information

Practice problems Set 2

Practice problems Set 2 Practice problems Set 2 1) Write a program to obtain transpose of a 4 x 4 matrix. The transpose of matrix is obtained by exchanging the elements of each row with the elements of the corresponding column.

More information

Lecture 04 FUNCTIONS AND ARRAYS

Lecture 04 FUNCTIONS AND ARRAYS Lecture 04 FUNCTIONS AND ARRAYS 1 Motivations Divide hug tasks to blocks: divide programs up into sets of cooperating functions. Define new functions with function calls and parameter passing. Use functions

More information

Screen3 View. Contents. Page 1

Screen3 View. Contents. Page 1 Screen3 View Contents Introduction What is EPA's SCREEN3 Model? What is the Screen3 View Interface? Toollbar Buttons Preliminary Considerations Source Inputs Screen3 Options Running SCREEN3 Model Graphic

More information

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit

For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/ For Solved Question Papers of UGC-NET/GATE/SET/PGCET in Computer Science, visit http://victory4sure.weebly.com/

More information

Introduction to FORTRAN

Introduction to FORTRAN Introduction to by Dr. Ibrahim A. Assakkaf Spring 2000 Department of Civil and Environmental Engineering University of Maryland Slide No. 1 Introduction = FORmula TRANslation Developed for the IBM 704

More information

Working with BACnet Group Objects

Working with BACnet Group Objects N30 Supervisory Controller User s Manual 33-1 Chapter 33 Working with BACnet Group Objects Introduction Note: Do not confuse the BACnet Group object with the Johnson Controls Group object. For information

More information

Programming for Non-Programmers

Programming for Non-Programmers Programming for Non-Programmers Python Chapter 2 Source: Dilbert Agenda 6:00pm Lesson Begins 6:15pm First Pillow example up and running 6:30pm First class built 6:45pm Food & Challenge Problem 7:15pm Wrap

More information

AccuTrac Multi-Point Data Acquisition Software User Guide

AccuTrac Multi-Point Data Acquisition Software User Guide AccuTrac Multi-Point Data Acquisition Software User Guide DEGREE CONTROLS, INCORPORATED Milford, New Hampshire 03055 USA AccuTrac Data Acquisition Software User Guide Page 1 of 19 Degree Controls Information

More information

MATLAB. Devon Cormack and James Staley

MATLAB. Devon Cormack and James Staley MATLAB Devon Cormack and James Staley MATrix LABoratory Originally developed in 1970s as a FORTRAN wrapper, later rewritten in C Designed for the purpose of high-level numerical computation, visualization,

More information

Lecture 6. Statements

Lecture 6. Statements Lecture 6 Statements 1 Statements This chapter introduces the various forms of C++ statements for composing programs You will learn about Expressions Composed instructions Decision instructions Loop instructions

More information

The Program Specification:

The Program Specification: Reading to Input Failure, Decisions, Functions This programming assignment uses many of the ideas presented in sections 3 through 8 of the course notes, so you are advised to read those notes carefully

More information

Control Constructs: Loops - while loops - iterative loops (counting loops)

Control Constructs: Loops - while loops - iterative loops (counting loops) 4. Loops Control Constructs: Loops - while loops - iterative loops (counting loops) While loop do... if (logical_expression) exit... do while (logical_expression)... statement block logical expression.false.

More information

8. Functions (II) Control Structures: Arguments passed by value and by reference int x=5, y=3, z; z = addition ( x, y );

8. Functions (II) Control Structures: Arguments passed by value and by reference int x=5, y=3, z; z = addition ( x, y ); - 50 - Control Structures: 8. Functions (II) Arguments passed by value and by reference. Until now, in all the functions we have seen, the arguments passed to the functions have been passed by value. This

More information

WHAT IS A DATABASE? There are at least six commonly known database types: flat, hierarchical, network, relational, dimensional, and object.

WHAT IS A DATABASE? There are at least six commonly known database types: flat, hierarchical, network, relational, dimensional, and object. 1 WHAT IS A DATABASE? A database is any organized collection of data that fulfills some purpose. As weather researchers, you will often have to access and evaluate large amounts of weather data, and this

More information

Functions. Lab 4. Introduction: A function : is a collection of statements that are grouped together to perform an operation.

Functions. Lab 4. Introduction: A function : is a collection of statements that are grouped together to perform an operation. Lab 4 Functions Introduction: A function : is a collection of statements that are grouped together to perform an operation. The following is its format: type name ( parameter1, parameter2,...) { statements

More information

CSci 1113 Lab Exercise 6 (Week 7): Arrays & Strings

CSci 1113 Lab Exercise 6 (Week 7): Arrays & Strings CSci 1113 Lab Exercise 6 (Week 7): Arrays & Strings Strings Representing textual information using sequences of characters is common throughout computing. Names, sentences, text, prompts, etc. all need

More information

Service Bulletin SB685. Date: 8/18/2017 TriPac EVOLUTION Communications Update Bulletin Location: TSA Info Central\Service Bulletins

Service Bulletin SB685. Date: 8/18/2017 TriPac EVOLUTION Communications Update Bulletin Location: TSA Info Central\Service Bulletins Service Bulletin SB685 Date: 8/18/2017 Subject: TriPac EVOLUTION Communications Update Bulletin Location: TSA Info Central\Service Bulletins Units: All TriPac EVOLUTION Summary: This bulletin updates and

More information

Thermal Design Tool for Outdoor Space Based on a Numerical Simulation System Using 3D-CAD

Thermal Design Tool for Outdoor Space Based on a Numerical Simulation System Using 3D-CAD September 2004 Page 1 of 6 Thermal Design Tool for Outdoor Space Based on a Numerical Simulation System Using 3D-CAD Takashi Asawa 1, Akira Hoyano 1 and Kazuaki Nakaohkubo 1 1 Tokyo Institute of Technology,

More information

Outline. More on Excel. Review Entering Formulas. Review Excel Basics Home tab selected here Tabs Different ribbon commands. Copying Formulas (2/2)

Outline. More on Excel. Review Entering Formulas. Review Excel Basics Home tab selected here Tabs Different ribbon commands. Copying Formulas (2/2) More on Excel Larry Caretto Mechanical Engineering 09 Programming for Mechanical Engineers January 6, 017 Outline Review last class Spreadsheet basics Entering and copying formulas Discussion of Excel

More information

DATA CUBE : A RELATIONAL AGGREGATION OPERATOR GENERALIZING GROUP-BY, CROSS-TAB AND SUB-TOTALS SNEHA REDDY BEZAWADA CMPT 843

DATA CUBE : A RELATIONAL AGGREGATION OPERATOR GENERALIZING GROUP-BY, CROSS-TAB AND SUB-TOTALS SNEHA REDDY BEZAWADA CMPT 843 DATA CUBE : A RELATIONAL AGGREGATION OPERATOR GENERALIZING GROUP-BY, CROSS-TAB AND SUB-TOTALS SNEHA REDDY BEZAWADA CMPT 843 WHAT IS A DATA CUBE? The Data Cube or Cube operator produces N-dimensional answers

More information

3. Can every Do-Loop loop be written as a For-Next loop? Why or why not? 4. Name two types of files that can be opened and used in a VB program.

3. Can every Do-Loop loop be written as a For-Next loop? Why or why not? 4. Name two types of files that can be opened and used in a VB program. CE 311 K Fall 005 Second Exam - Examples Answers at the bottom. 1. What are two categories of flow control structures?. Name three logical operators in Visual Basic (VB). 3. Can every Do-Loop loop be written

More information

10/9/17. Using recursion to define objects. CS 220: Discrete Structures and their Applications

10/9/17. Using recursion to define objects. CS 220: Discrete Structures and their Applications Using recursion to define objects CS 220: Discrete Structures and their Applications Recursive objects and 6.9 6.10 in zybooks We can use recursion to define functions: The factorial function can be defined

More information

Applied Ballistics Ultralite Engine

Applied Ballistics Ultralite Engine Bushnell Ballistics For Android and iphone The Bushnell Ballistics App, is a companion app to use with your Bushnell Scopes to calculate firing solutions. This app allows you to use current atmospherics

More information