Inputs, Outputs and Assignment

Slides:



Advertisements
Similar presentations
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
Advertisements

Chapter 1 Program Design
BPC.1 Basic Programming Concepts
1 The First Step Learning objectives write Java programs that display text on the screen. distinguish between the eight built-in scalar types of Java;
© The McGraw-Hill Companies, 2006 Chapter 1 The first step.
Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals.
IXA 1234 : C++ PROGRAMMING CHAPTER 1. PROGRAMMING LANGUAGE Programming language is a computer program that can solve certain problem / task Keyword: Computer.
Python Let’s get started!.
Controlling Program Flow with Decision Structures.
JavaScript Introduction and Background. 2 Web languages Three formal languages HTML JavaScript CSS Three different tasks Document description Client-side.
Introduction to Algorithmic Processes CMPSC 201C Fall 2000.
Chapter 1: Introduction to Computers and Programming
Bill Tucker Austin Community College COSC 1315
Starter What does the following code do?
Unit 2 Technology Systems
The Little man computer
CST 1101 Problem Solving Using Computers
Introduction to Computing Science and Programming I
3.1 Fundamentals of algorithms
User-Written Functions
COMPUTATIONAL CONSTRUCTS
Component 1.6.
Input and Output Upsorn Praphamontripong CS 1110
Introduction to Programming and Visual Basic
Data Types Variables are used in programs to store items of data e.g a name, a high score, an exam mark. The data stored in a variable is entered from.
Python Let’s get started!.
1-1 Logic and Syntax A computer program is a solution to a problem.
Key Ideas from day 1 slides
Chapter 3: Variables, Functions, Math, and Strings
Chapter 3: Variables, Functions, Math, and Strings
Programming Mehdi Bukhari.
Design & Technology Grade 7 Python
The Selection Structure
Variables, Expressions, and IO
Design and Technology Academic Year 2017/2018 Grade 7 First Semester.
Functions CIS 40 – Introduction to Programming in Python
Keyboard Input and Screen Display ––––––––––– Interactive Programming
2008/09/24: Lecture 6b CMSC 104, Section 0101 John Y. Park
Starter Read the Feedback Click on Add new Feedback Open Realsmart
An Introduction to Visual Basic .NET and Program Design
CS 240 – Lecture 11 Pseudocode.
Chapter 1: Introduction to Computers and Programming
WEB PROGRAMMING JavaScript.
Programming Right from the Start with Visual Basic .NET 1/e
Variables ICS2O.
An Introduction to Structured Program Design in COBOL
We are starting to program with JavaScript
SME1013 PROGRAMMING FOR ENGINEERS
Loops CIS 40 – Introduction to Programming in Python
SME1013 PROGRAMMING FOR ENGINEERS
We are starting JavaScript. Here are a set of examples
Language Constructs Construct means to build or put together. Language constructs refers to those parts which make up a high level programming language.
Spreadsheets, Modelling & Databases
Flowcharts and Pseudo Code
Welcome to AP Computer Science A!
Welcome to AP Computer Science A!
Developing a Program.
Winter 2019 CISC101 4/28/2019 CISC101 Reminders
Unit 3: Variables in Java
L L Line CSE 420 Computer Games Lecture #3 Introduction to Python.
WJEC GCSE Computer Science
Starter Which of these inventions is: Used most by people in Britain
3.2 Working with Data Scope of variables 29/07/2019.
Python SAT 1 Feedback.
Variables, Constants, Assign.
Digital Computer & Digital Systems
Programming Techniques :: Flow Diagrams and Pseudocode
Getting Started With Coding
Programming Techniques
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

Inputs, Outputs and Assignment Keywords Input, Output, Assignment, Pseudocode, Flowchart, Identifier, Variable, Constant Concatenation, Memory locations, Parameters Variables Inputs, Outputs and Assignment

What is a variable? What is assignment? Objectives INPUT Name BEGINNER: Explain input, assignment and outputs within programming. ADVANCED: Identify variables and constants in programs. EXPERT: Develop programs to solve problems that use constants, variables, inputs, assignment and outputs. Computer programs accept inputs from a user, processes them using some constants and outputs back to the user. It is a good idea to label various inputs, constants and outputs with descriptive names (the process known as assignment). None of them should start with a number or contain spaces. Phrase = “I like you ”+ Name INPUT Name OUTPUT Phrase What is assignment? Starter activity During assignment, information is stored in memory locations under descriptive names called “identifiers”. A memory location where information relevant to the program running is stored is called: - “a variable” if it changes throughout the program or - “a constant” if it is fixed for the duration of the program.

BIG PICTURE Objectives BEGINNER: Explain input, assignment and outputs within programming. ADVANCED: Identify variables and constants in programs. EXPERT: Develop programs to solve problems that use constants, variables, inputs, assignment and outputs. Variables are like building blocks or containers from which we build up our programs. Like blocks in Tetris, variables come in different types, like different containers for different purposes in real life: - a milk jug looks different from a petrol can - liquids are stored differently from solids. Starter activity

Memory Locations Objectives BEGINNER: Explain input, assignment and outputs within programming. ADVANCED: Identify variables and constants in programs. EXPERT: Develop programs to solve problems that use constants, variables, inputs, assignment and outputs. Any information that a program makes use of, e.g. user's age, is stored in RAM while the program runs. RAM is divided in memory locations with long hexadecimal (but really binary) addresses. Here, we use Python to find out the addresses hiding behind the labels "a" and "b" that we gave them to store values 6 and 8, respectively. Starter activity

Coding vs Spreadsheets Objectives BEGINNER: Explain input, assignment and outputs within programming. ADVANCED: Identify variables and constants in programs. EXPERT: Develop programs to solve problems that use constants, variables, inputs, assignment and outputs. We have renamed our variables from the spreadsheet style to the one more common on programming. Starter activity Why did we rename A1 and B1 to first_num and second_num?

Pseudocode vs Flowcharts Objectives BEGINNER: Explain input, assignment and outputs within programming. ADVANCED: Identify variables and constants in programs. EXPERT: Develop programs to solve problems that use constants, variables, inputs, assignment and outputs. START SPACE = “ “ INPUT Name Phrase = “Hello” + SPACE + Name OUTPUT Phrase END Starter activity

Constants Objectives BEGINNER: Explain input, assignment and outputs within programming. ADVANCED: Identify variables and constants in programs. EXPERT: Develop programs to solve problems that use constants, variables, inputs, assignment and outputs. In the previous program one of the labels (SPACE) was in capital letters. This refers to memory locations that hold CONSTANT values. Constants are values that don’t change as the program runs. Here is another well-known constant: Starter activity

Output Computers are general-purpose problem solving machines. Objectives BEGINNER: Explain input, assignment and outputs within programming. ADVANCED: Identify variables and constants in programs. EXPERT: Develop programs to solve problems that use constants, variables, inputs, assignment and outputs. Computers are general-purpose problem solving machines. Just like most machines, they need raw materials, known as inputs, time and instructions to process the inputs the results, known as outputs. Example of output: Starter activity A program stores a message that it wants to display to user.

Inputs Objectives BEGINNER: Explain input, assignment and outputs within programming. ADVANCED: Identify variables and constants in programs. EXPERT: Develop programs to solve problems that use constants, variables, inputs, assignment and outputs. Without inputs, our programs are not very useful as they can’t interact with the outside world and always produce the same result. We are going to create a program that asks user to input their name and then greets them by concatenating (joining) their name with a greeting. Inputs come from the console, from a file, or from elsewhere in a modular program – are known as “parameters”. Starter activity

Inputs and assignments Objectives BEGINNER: Explain input, assignment and outputs within programming. ADVANCED: Identify variables and constants in programs. EXPERT: Develop programs to solve problems that use constants, variables, inputs, assignment and outputs. In most programming languages, inputs come as text. “1234” is still text, until you need to use it in calculation – at which point it needs to be converted to a number. Once the data is input into the program, we often need to store it. We store data by “assigning” it to a memory location with a descriptive label, known as a “variable”. INPUT UserName INCREMENT attempts UserName recognized? YES INPUT Pwd NO OUTPUT “Try again” Starter activity

Problem Solving Objectives BEGINNER: Explain input, assignment and outputs within programming. ADVANCED: Identify variables and constants in programs. EXPERT: Develop programs to solve problems that use constants, variables, inputs, assignment and outputs. In Physics, we can look at an object falling from rest. The formula for its velocity after a time of t seconds is v = g * t where g is the acceleration of gravity. The value for g on planet Earth is 9.8 m/s2 . A. What is the velocity of a tennis ball after 5 seconds of falling? Starter activity

Variables and Constants Objectives BEGINNER: Explain input, assignment and outputs within programming. ADVANCED: Identify variables and constants in programs. EXPERT: Develop programs to solve problems that use constants, variables, inputs, assignment and outputs. In the example program we used capital letter G for gravity acceleration. We use CAPITAL letters for CONSTANTS – values that don’t change between the program runs (they remain, “constant”). Marking constants in capitals simplifies debugging (constants are less likely to generate mistakes as they don’t change during runtime) and is good industry practice. Starter activity VARIABLE CONSTANT