Variables.. Part 2 Calculations. Review of yesterday Three types of variables var num:int var average:real var username:string No decimals Might have.

Slides:



Advertisements
Similar presentations
More on Psuedo-Code Sangeetha Parthasarathy 1/23/01.
Advertisements

Lesson 5 Homework: Logic and Planning Tools A step by step solution guide.
CS107 Introduction to Computer Science Lecture 3, 4 An Introduction to Algorithms: Loops.
Chapter 3 Program Design And Branching Structures.
Function Input and Output Lesson The Magic Box Consider a box that receives numbers in the top And alters them somehow and sends a (usually) different.
Making a Flow Chart Handout. Flowcharting Example #1 Design a flowchart that finds the average of a persons 3 class marks.
Case studies over control structures and iterative structures Instructor – Gokcen Cilingir Cpt S 121 (July 6, 2011) Washington State University.
1 9/29/06CS150 Introduction to Computer Science 1 Loops Section Page 255.
1 9/15/06CS150 Introduction to Computer Science 1 Combined Assignments, Relational Operators, and the If Statement.
1 11/3/08CS150 Introduction to Computer Science 1 Reading from and Writing to Files Section 3.12 & 13.1 & 13.5.
1 9/29/06CS150 Introduction to Computer Science 1 Loops Section Page 255.
1 9/24/07CS150 Introduction to Computer Science 1 Relational Operators and the If Statement.
1 9/28/07CS150 Introduction to Computer Science 1 Loops section 5.2, 5.4, 5.7.
1 10/29/07CS150 Introduction to Computer Science 1 Reading from and Writing to Files Section 3.12 & 13.1 & 13.5.
Python November 14, Unit 7. Python Hello world, in class.
Begin Java having used Alice Pepper - Some slides from Alice in Action with Java.
1 CS150 Introduction to Computer Science 1 Relational Operators and the If Statement 9/22/08.
1 10/25/06CS150 Introduction to Computer Science 1 Reading from and Writing to Files.
Basic Input/Output and Variables Ethan Cerami New York
Intro to C++. Getting Started with Microsoft Visual Studios Open Microsoft Visual Studios 2010 Click on file Click on New Project Choose Visual C++ on.
VARIABLES & CONSTANTS. Objective By the end of the lesson students should be able to:  Define a constant  Define a variable  Understand the rules for.
CS 177 Week 4 Recitation Slides Variables, Files and Functions.
1 Week 1: Variables, assignment, expressions READING: 1.2 – 1.4.
Math – What is a Function? 1. 2 input output function.
Assignment statement and Arithmetic operation 1 The major part of data processing.
Math, Data Types. Python Math Operations OperationOperator Addition + Subtraction – Multiplication * Division (floating point) / Division (integer) //
Loops CS 103 February 13, 2009 Author: Nate Hamm.
Structured Programming (4 Credits) HNDIT Week 2 – Learning Outcomes Design an algorithmic solution for simple problem such as computation of a factorial,
Variables and Expressions CMSC 201. Today we start Python! Two ways to use python: You can write a program, as a series of instructions in a file, and.
ENG 1181 College of Engineering Engineering Education Innovation Center 1 Script File Input – Output : Chapter 4 PLEASE HAVE STUDENTS START MATLAB NOW.
Using variable Variables are used to store values.
Lesson 9.8: Multiplication of Decimals
Variables in VB. What is a variable? ► A named memory location that stores a value.
GCSE Computing: Programming GCSE Programming Remembering Python.
Computer Programming 12 Mr. Jean March 5 th, 2014.
CS 101 – Oct. 7 Solving simple problems: create algorithm Structure of solution –Sequence of steps (1,2,3….) –Sometimes we need to make a choice –Sometimes.
Input and Output Output Prompt: –A message displayed to the user indicating what they are to enter. Should be clear and exact on what you want. write:
Review: A Structural View program modules -> main program -> functions -> libraries statements -> simple statements -> compound statements expressions.
Algebra 1 Section 7.1 Solve systems of linear equations by graphing Recall: linear equation in 2 variables ax + by = c The solution to a system of equations.
Mechanical Definitions & Equations Terms we need to know Equations we need to know.
Input, Output and Variables GCSE Computer Science – Python.
2.3 Output Formatting. Outputting Format Specify the number of spaces, “c”, used to print an integer value with specifier %cd, e.g., %3d, %4d. E.g. printf.
Programming on the TI-84 and TI-Nspire
Type your name and send:
MATLAB – More Script Files
What’s cheating and what is not?
Sequential Structures
Variables In programming, we often need to have places to store data. These receptacles are called variables. They are called that because they can change.
Computers & Programming Languages
Math and Data Types Practice Problems
Function Input and Output
Lecture Notes 8/24/04 (part 2)
Class Examples.
Inputs and Variables Programming Guides.
Compare and Order Whole Numbers and Decimals
How did you decide what to wear today?
Algebra 2 Ch.3 Notes Page 15 P Solving Systems Algebraically.
Flowcharts and Pseudo Code
21 3 Variables Selection Functions Repetition Challenge 21
Programming Concepts and Database
Developing a Program.
Assignment #3 Programming Language, Spring 2003
Variables Here we go.
Basic Lessons 5 & 6 Mr. Kalmes.
Data Types and Maths Programming Guides.
Unit 1: Intro Lesson 4: Output.
Dry Run Fix it Write a program
GCSE Computing Mini Assignment.
Chapter 2 Modular Programs with Calculations and Strings
Getting Started in Python
Presentation transcript:

Variables.. Part 2 Calculations

Review of yesterday Three types of variables var num:int var average:real var username:string No decimals Might have decimals Has letters or characters

Structure var statements at the top Ask for input Produce output Example: Ask the user for their name and their mark in Math and Science. Print the output.

The assignment operator! X := 7 X “is assigned” the value of 7

Calculations Example.. Blue Jays tickets cost $91.25 each. Write a program that will ask how many tickets the user would like and will print the total. var numtickets:int var total:real put "How many tickets".. get numtickets total := * numtickets put "Your total is $",total

Example 2 Ask the user for their name and their mark in Math and Science. Print their average in the two subjects. How many variables do we need? Next page

Example 2 Ask the user for their name and their mark in Math and Science. Print their average in the two subjects. Solution: var math, science:int var average:real var nme:string put "Your name please".. get nme put "What is you Math mark".. get math put "Give me your Science mark".. get science average:= (math + science) / 2 put "Your average is ",average,"%"