Algorithms For use in Unit 2 Exam.

Slides:



Advertisements
Similar presentations
PROBLEM SOLVING TECHNIQUES
Advertisements

CSE 1301 Lecture 6B More Repetition Figures from Lewis, “C# Software Solutions”, Addison Wesley Briana B. Morrison.
ALGORITHMS AND FLOWCHARTS
Goals of Course Introduction to the programming language C Learn how to program Learn ‘good’ programming practices.
Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals.
By the end of this session you should be able to...
Python Repetition. We use repetition to prevent typing the same code out many times and to make our code more efficient. FOR is used when you know how.
Coding Design Tools Rachel Gauci. What are Coding Design Tools? IPO charts (Input Process Output) Input- Make a list of what data is required (this generally.
30/10/ Iteration Loops Do While (condition is true) … Loop.
Even more problems.. Mean (average) I need a program that calculates the average of student test scores. I need a program that calculates the average.
CS161 Topic #16 1 Today in CS161 Lecture #16 Prepare for the Final Reviewing all Topics this term Variables If Statements Loops (do while, while, for)
Think Possibility 1 Iterative Constructs ITERATION / LOOPS C provides three loop structures: the for-loop, the while-loop, and the do-while-loop. Each.
 Software Development Life Cycle  Software Development Tools  High Level Programming:  Structures  Algorithms  Iteration  Pseudocode  Order of.
Count Controlled Loops (Nested) Ain’t no sunshine when she’s gone …
Topic: Control Statements. Recap of Sequence Control Structure Write a program that accepts the basic salary and allowance amount for an employee and.
Flowchart. a diagram of the sequence of movements or actions of people or things involved in a complex system or activity. a graphical representation.
1 4.2 Selection Logical Operators. 2 Learning Objectives Explain how the logical operator AND Boolean statements works. Directly testing if text boxes.
Selection Using IF THEN ELSE CASE Introducing Loops.
26/06/ Iteration Loops For … To … Next. 226/06/2016 Learning Objectives Define a program loop. State when a loop will end. State when the For.
Input, Output and Variables GCSE Computer Science – Python.
Marr CollegeHigher Software DevelopmentSlide 1 Higher Computing Software Development Topic 4: Standard Algorithms.
Programming revision Revision tip: Focus on the things you find difficult first.
7 - Programming 7J, K, L, M, N, O – Handling Data.
Starter What does the following code do?
ALGORITHMS AND FLOWCHARTS
3.1 Fundamentals of algorithms
IGCSE 4 Cambridge Data types and arrays Computer Science Section 2
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.
Algorithms and Flowcharts
Chapter 5: Control Structure
Introduction to Programmng in Python
Lecture 07 More Repetition Richard Gesick.
Lecture 4B More Repetition Richard Gesick
Siti Nurbaya Ismail Senior Lecturer
For Monday Read WebCT quiz 18.
*current controlled assessment plans are unknown
ALGORITHMS AND FLOWCHARTS
Print slides for students reference
IPC144 Introduction to Programming Using C Week 2 – Lesson 1
Control Structure Senior Lecturer
Control Structure Senior Lecturer
Python I/O.
Standard Algorithms Input validation Finding the minimum
Algorithms & Pseudocode
More Loops.
Programming In Lesson 3.
ALGORITHMS AND FLOWCHARTS
If selection construct
For Wednesday No new reading No quiz.
Do While (condition is true) … Loop
If selection construct
3.1 Iteration Loops For … To … Next 18/01/2019.
Inputs and Variables Programming Guides.
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
Language Constructs Construct means to build or put together. Language constructs refers to those parts which make up a high level programming language.
Flowcharts and Pseudo Code
Lets Play with arrays Singh Tripty
Programming Concepts and Database
AP Java 9/21/2018.
Functions continued.
Java Programming Loops
Therapies. Interpreting and writing algorithms
The while Looping Structure
Dry Run Fix it Write a program
WJEC GCSE Computer Science
Programming Concepts and Database
What you need to do… Drag the pieces of code into the correct order like you can see in the EXAMPLE below. print ( “ int input ) = + Hello world chr ord.
The while Looping Structure
GCSE Computing.
Python Creating a calculator.
Presentation transcript:

Algorithms For use in Unit 2 Exam

Algorithms – recap Declare variables that you intend to use Declare numberOfSprints = 0 Declare sprintTime = 0 Declare fastestTime = 100 Declare slowestTime = 0 Declare totalTime = 0 Declare average as real = 0

Algorithms – recap Output and input – to display information and input data. Output “Welcome to the 100m sprint training program” Output “Enter the number of sprints completed” Input numberOfSprints

Algorithms – recap If statement. The section below updates the fastestTime variable if the sprint time is a lower value. if sprintTime < fastestTime then fastestTime = sprintTime endif

Algorithms – recap If statement. Enter an if statement in the space below to update the slowestTime variable if the sprint time is a greater value.

Algorithms – recap Loops – Repeat Until. Or For i = 1 to 10 For i = 1 to numberOfSprints Output “Enter sprint time” Input sprintTime **additional code could be placed here ** Next for

Algorithms – recap Loops – Repeat Until. Or For i = 1 to 10 Repeat Output “Enter sprint time” Input sprintTime **additional code could be placed here ** Until NumberofSprints

Algorithms – recap Loop In the space below write a loop that asks the user the age of 5 pupils and outputs whether they may learn to drive a car (over the age of 16).

Calculations Calculations are very similar if not identical in an algorithm when compared to code in a high level language such as Python. e.g. totalTime = totalTime + sprintTime

Task 1 Write an algorithm to perform the following: Have a heading that states Bish Maths Test Enter 6 marks for a maths test. Use a loop For each mark state whether a Pass can be awarded (mark must be greater than 5). Assume mark is out of 10. Calculate and output the highest, lowest and average marks. #hint – you need to calculate highest, lowest and total within the loop as demonstrated on previous slides.

Task 1 - Solution

2016 Exam

2016 - Answer

2016 - Answer

Arrays (Lists) Lists can store multiple values, they are also known as arrays. Declare goalsScored array (1..99) of integer Declare matchgoal = 0 For i = 1 to 11 Output “Enter goals scored for player”, i Input matchgoal goalsScored[i] = goalsScored[i] + matchgoal Output “Your goals for the season are “, goalsScored[i] Next i

Task 2 Write an algorithm to perform the following: Have a heading that states Bish Computing Test Enter marks for four pupils who have completed three tests. Store their totals in an array. Calculate and output the average mark for each pupil.

Task 2 Solution

2015 Exam

2015 - Answer

2015 - Answer