1. Exam Topics Difference between computers and calculators John creates a new device. It will compute the orbit of all the planets in the solar system.

Slides:



Advertisements
Similar presentations
 2005 Pearson Education, Inc. All rights reserved Introduction.
Advertisements

ITEC113 Algorithms and Programming Techniques
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 4 – Introducing Algorithms, Pseudocode and.
JavaScript, Fourth Edition
JavaScript, Third Edition
1 Chapter Two Using Data. 2 Objectives Learn about variable types and how to declare variables Learn how to display variable values Learn about the integral.
Chapter 4 MATLAB Programming Combining Loops and Logic Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Lecture 2 - Variables, program execution, calculations, print() COMPSCI 101 Principles of Programming.
Chapter 2 Getting Started in C Programming
Exam 1: Review 1.History of computers 2.Fundamentals of computer architecture 3.Developing algorithms and programs 4.Variables and data types 5.User I/O.
Fortran 1- Basics Chapters 1-2 in your Fortran book.
CIS Computer Programming Logic
Lecture 4 Input/Output Conditional Statements 1. Data Types 2. Input/Outputs 3. Operators 4. Conditionals 1.
Lecture 4 MATLAB Windows Arithmetic Operators Maintenance Functions
REVIEW 2 Exam History of Computers 1. CPU stands for _______________________. a. Counter productive units b. Central processing unit c. Copper.
Copyright 2006 Addison-Wesley Brief Version of Starting Out with C++ Chapter 2 Introduction to C++
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 6 Value- Returning Functions and Modules.
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 CST 221 OBJECT ORIENTED PROGRAMMING(OOP) ( 2 CREDITS.
2440: 211 Interactive Web Programming Expressions & Operators.
Presenting results to the USER in a professional manner 1. semicolon, disp(), fprintf() 2. Placeholders 3. Special characters 4. Format-modifiers Output.
Chapter 3: Data Types and Operators JavaScript - Introductory.
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 4 – Wage Calculator Application: Introducing.
Visual Basic.NET BASICS Lesson 4 Mathematical Operators.
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley STARTING OUT WITH Python Python First Edition by Tony Gaddis Chapter 2 Input,
Input, Output, and Processing
Fall 2006AE6382 Design Computing1 Control Statements in Matlab Topics IF statement and Logical Operators Switch-Case Disp() vs fprintf() Input() Statement.
Computer Science 101 Introduction to Programming.
Introduction to Computer Programming Using C Session 23 - Review.
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
CMPS 1371 Introduction to Computing for Engineers MatLab.
C++ Programming: Basic Elements of C++.
1 INTRODUCTION TO PROBLEM SOLVING AND PROGRAMMING.
CIS-165 C++ Programming I CIS-165 C++ Programming I Bergen Community College Prof. Faisal Aljamal.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
Control Structures (A) Topics to cover here: Introduction to Control Structures in the algorithmic language Sequencing.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Data Types and Operations On Data Objective To understand what data types are The need to study data types To differentiate between primitive types and.
Asking the USER for values to use in a software 1 Input.
Chapter 4 Controlling Execution CSE Objectives Evaluate logical expressions –Boolean –Relational Change the flow of execution –Diagrams (e.g.,
Lecture 5 1.What is a variable 2.What types of information are stored in a variable 3.Getting user input from the keyboard 1.
Introducing C++ Programming Lecture 3 Dr. Hebbat Allah A. Elwishy Computer & IS Assistant Professor
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.
Asking the USER for values to use in a software 1 Input.
1 CS1371 Introduction to Computing for Engineers Control Statements 9/4/2003.
Topic Review for Exam 1 0.Infrastructure: You must be able to use MATLAB, Blackboard Exams, and Blackboard submissions 1. Computer Developing algorithms.
Fall 2006AE6382 Design Computing1 Control Statements in Matlab Topics IF statement and Logical Operators Switch-Case Disp() vs fprintf() Input() Statement.
Lecture 6: Output 1.Presenting results in a professional manner 2.semicolon, disp(), fprintf() 3.Placeholders 4.Special characters 5.Format-modifiers 1.
C++ for Engineers and Scientists Second Edition
Introduction to Java Applications Part II. In this chapter you will learn:  Different data types( Primitive data types).  How to declare variables?
CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 5, Lecture 2 (Tuesday)
Interduction to MATLAB (part 2) Manal Alotaibi Mathematics department College of science King saud university.
1. COMPUTERS AND PROGRAMS Rocky K. C. Chang September 6, 2015 (Adapted from John Zelle’s slides)
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
CS Class 04 Topics  Selection statement – IF  Expressions  More practice writing simple C++ programs Announcements  Read pages for next.
Overview Input Input statements Menu statements Output Display statements fprintf statements Message boxes.
7 - Programming 7J, K, L, M, N, O – Handling Data.
Topic: Python’s building blocks -> Statements
Control Statements in Matlab
Revision Lecture
MATLAB (Lecture 2) BY:MAHA ALMOUSA.
Programming Funamental slides
SELECTIONS STATEMENTS
Introduction to Java Applications
Matlab Basics.
DATA TYPES There are four basic data types associated with variables:
MATLAB (Lecture 2) BY:MAHA ALMOUSA.
Electrical and Computer Engineering Department SUNY – New Paltz
Presentation transcript:

1

Exam Topics Difference between computers and calculators John creates a new device. It will compute the orbit of all the planets in the solar system simultaneously. Since it won’t do anything else, he hopes to one day make another machine that will compute the orbit of the stars in the Milky Way. Is John’s current device a computer? a calculator? 2

Exam Topics Software, Hardware, and Media Provide a simple definition for software. What classification is a DVD? 3

Exam Topics Software: OS, apps, compilers Describe the purpose of a compiler. What differentiates the Operating System (OS) from an application (app)? 4

Exam Topics Language generations Sort the following languages in order of generation, low to high: English MATLAB Machine Assembly 5

Exam Topics What piece of hardware is the basis for modern computers? Why do say that computers work in "binary"?

Exam Topics 5-step Process: Identify and describe the five steps for this problem: I need a computer program that will compute the volume of any right regular prism with 10 sides or less. 7

8 Exam Topics Developing Solutions I/O Diagrams 5-Step Process State the Problem Identify inputs & outputs Manually solve the problem Computerize: Algorithm & code Test, test, test! Syntax Semantics

9 Exam Topics Developing Solutions

10 Exam Topics Developing Solutions

Exam Topics I/O Diagrams Prepare an I/O diagram for the program desired: I need a program to compute the time required to get to Mars and how much fuel is needed, assuming I leave six months from the day the program is run. 11

Exam Topics Know variable and file naming constraints Understand the functions listed in the lecture notes [e.g. sin(), cos(), sind(), cosd(), sqrt(), etc] – know the difference between sin() and sind(), for example. What is ans ? What does clear do? What about clc ? How do you suppress default output? 12

Exam Topics A data type is a category of information. The data type determines how information is stored in the computer and how it can be used. Integers whole numbers Floats numbers with fractional portion Strings sequences of characters 13

14 Exam Topics Starting with MATLAB

15 Exam Topics Starting with MATLAB

16 Exam Topics I/O

17 Exam Topics Input and Output The input() function What is a "prompt"? "Collecting the return value" Strings vs. Numbers The disp() function

Exam Topics The input function: Provide the MATLAB code that will use the input() function to obtain from the user the cost (in dollars) for an item, storing the information in the variable cost_per_item. Provide the MATLAB code that will use the input() function to obtain from the user the name for an item, storing the information in the variable item_name. 18

Exam Topics Simple output: disp() Tricky question: Use the disp() function to display the value of π to four decimal places. 19

20 Exam Topics Input and Output The fprintf() function The format string Placeholders Format modifiers left justification width specifier precision specifier Escape sequences

Exam Topics Formatted output: fprintf() fprintf(‘%11s said he made $%-7.2f/year\n’, name, paycheck); From the MATLAB command above, identify … All placeholders All format modifiers All escape sequences 21

Exam Topics Using fprintf() and the provided variables for the red portions, provide the MATLAB statement that will display this sentence: _ _ _ _John wants Jill_ _ _ to run up the hill 16 times (where _ indicates a blank space) A = ‘John’ B = ‘Jill’ C = ‘up’ D = 4 22

Exam Topics Assuming the variables used are name, age, and income, provide an fprintf() statement that contains no spaces and will align the columns for any line in the table. Fred Flintstone 47$ Barney "The Man" Rubble148 $ 3.25

Exam Topics Unary vs Binary operators &, &&, |, ||, +, -, *, /, ~, <, =, == From the set of operators above… Which one(s) can be used as either unary or binary operators? Which one(s) are only unary operators? 24

Exam Topics Numeric: Identify each of these operators Multiplication (scalar) Multiplication (matrix) Division (scalar) Division (matrix) Addition (scalar) Addition (matrix) Subtraction (scalar) Subtraction (matrix) Exponentiation (scalar) Exponentiation (matrix) Assignment 25

Exam Topics Name these operators: Relational <, >, <=, >=, ==, ~= Boolean &&, ||, ~ Know the true and false keywords 26

27 Exam Topics Operators

Exam Topics Functions name = input(‘Enter a username:\n’, ‘s’); In the MATLAB statement above, which symbol(s) indicate… - the arguments - collecting return values - the function call 28

Exam Topics Modulus How would you determine if a user-provided value (stored in the variable x ) is divisible by 17? 29

30 Exam Topics Conditionals The IF statement What is the purpose of the IF statement? When should we choose an IF over a SWITCH? Do IF statements repeat? What code can go in IF, ELSEIF, and ELSE clauses?

Exam Topics IF / ELSEIF / ELSE: Construct an IF statement that will print ‘Yes’ if the shuttle will launch; ‘No’ if the shuttle will not launch; ‘Maybe’ if it is unsure. Use a variable of your own choosing. 31

32 Exam Topics Conditionals Boolean expressions Using &&, ||, and ~ What is the output of this code? a = true; b = 1; c = -4; if a && ~(b>c) disp('IF'); else disp('ELSE'); end

33 Exam Topics Conditionals

34 Exam Topics Conditionals Boolean expressions Can we do this? if a == 1 || 2 || 3 disp('Yes'); else disp('No'); end How about: if 0 < a < b

35 Exam Topics Conditionals The SWITCH statement What is the purpose of the SWITCH statement? When should we choose an SWITCH over an IF? Do SWITCH statements repeat? What goes after the word "switch"? What code can go in the cases?

Exam Topics SWITCH / CASE: Provide a SWITCH-CASE statement that will process the menu below. Use a variable of your own choosing. Press 1 to Jump Press 2 to Duck Press anything else to walk forward 36

37 Exam Topics Library Functions What is a function? Why use functions? What are library functions?

38 Exam Topics Library Functions What is a function call? What is an argument? What is a return value? Can we have more than one? What does it mean to "collect" the return value? Must we provide arguments? Must we collect the return value?

39 Exam Topics Library Functions

40 Exam Topics Nesting What does this mean? What can we nest? What syntax issue should we watch?

Review for Exam 1 End of Presentation