CSEB114: Principle of programming

Slides:



Advertisements
Similar presentations
CS 240 Computer Programming 1
Advertisements

Representing an algorithm using Flowcharts
Al-Karma Language School Computer Department Prep. 3.
Introduction to Flowcharting
Introduction to Flowcharting A Supplement to Starting Out with C++, 4th Edition by Tony Gaddis Published by Addison-Wesley.
Subject: Information Technology Grade: 10
INTRODUCTION TO PROGRAMMING
Chapter 2- Visual Basic Schneider
The Program Development Cycle and Program Design Tools
Designing Algorithms Csci 107 Lecture 3. Designing algorithms Last time –Pseudocode –Algorithm: computing the sum 1+2+…+n –Gauss formula for 1+2+…+n Today.
1 Chapter 2 Problem Solving Techniques INTRODUCTION 2.2 PROBLEM SOLVING 2.3 USING COMPUTERS IN PROBLEM SOLVING : THE SOFTWARE DEVELOPMENT METHOD.
Review Algorithm Analysis Problem Solving Space Complexity
Algorithm & Flowchart.
COS120 Software Development Using C++ AUBG Fall semester 2010
Name ______ Gr.__ Lesson 4.2 – Circumference of a Circle Jan.__ Objective: to investigate the relationship between the circumference and diameter of a.
CIRCUMFERENCE OF A CIRCLE LEARNING TARGET 4: I CAN SOLVE PROBLEMS USING AREA AND CIRCUMFERENCE OF A CIRCLE.
  investigate the relationship between the diameter and circumference of a circle.
Chapter 10 Lesson 1: Circles and Circumference Objective: Learn to find the circumference of circles.
Computer Programming 12 Lesson 2 - Organizing the Problem By Dan Lunney.
Chapter 2: Developing a Program Prelude to Programming Concepts and Design Copyright © 2001 Scott/Jones, Inc.. All rights reserved. 1 Chapter 2 Developing.
8-1C The Circumference of a Circle What is circumference? What is pi? What is the symbol for pi? What are the formulas for the circumference of a circle?
U NDERSTANDING P ROBLEMS AND HOW TO S OLVE THEM BY USING C OMPUTERS.
E0001 Computers in Engineering
Chapter 2: Beginning the Problem-Solving Process
1 Introduction to Flowcharting. 2 Writing a program Defining the problem –Write down what the program will do Planning –Write down the steps, draw a flowchart.
1 Introduction to Flowcharting. 2 Writing a program Defining the problem –Write down what the program will do Planning –Write down the steps, draw a flowchart.
Circumference and Area of a Circle. Diameter Radius centre What is the formula relating the circumference to the diameter?
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Flowcharts.
CSE 102 Introduction to Computer Engineering What is an Algorithm?
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
LESSON 7.6 AREA AND CIRCUMFERENCE OF CIRCLES OBJECTIVE: To use formulas for the circumference and area of circles.
Starter The perimeter of this sector is (2r + 12∏) m. Find the radius r m, of the sector. r m.
Flowcharts.
Problem Solving and Program Design in C (5th Edition) by Jeri R. Hanly and Elliot B. Koffman Chapter 1 (Software Development Method) © CPCS
Circles: Circumference & Area Tutorial 8c A farmer might need to find the area of his circular field to calculate irrigation costs.
 Radius – The distance from the center of the circle to the endpoint.
Value and Reference Parameters. CSCE 1062 Outline  Summary of value parameters  Summary of reference parameters  Argument/Parameter list correspondence.
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.
Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.
Circumference Lesson #33. What is Circumference? The distance around the outside of a circle is called the circumference (essentially, it is the perimeter.
Lecture 13: 10/10/2002CS149D Fall CS149D Elements of Computer Science Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture.
CSEB114: PRINCIPLE OF PROGRAMMING Quiz 1. Rules  No cheating  No reference  No discussion  Only best 5 quizzes will be counted in your final marks,
CSCI-100 Introduction to Computing
Circumference Review. Review What is the relationship between a radius and a diameter? What does a circumference measure? What formulas do we use to calculate.
1 Programming Tools Flowcharts Pseudocode Hierarchy Chart Direction of Numbered NYC Streets Algorithm Class Average Algorithm.
1 MODULAR DESIGN AND ABSTRACTION. 2 SPECIFYING THE DETAILS OF A PROBLEM INTO A RELATED SET OF SMALLER PROBLEMS.
Calculator Tricks Magic Buttons for the TI-30Xa. Squares Squared 5 2 A = s 2 (area of a square) Find the following: 1.12 squared 2.Area of a square with.
Algorithm Discovery and Design Objectives: Interpret pseudocode Write pseudocode, using the three types of operations: * sequential (steps in order written)
Flowchart. a diagram of the sequence of movements or actions of people or things involved in a complex system or activity. a graphical representation.
Transparency 3 Click the mouse button or press the Space Bar to display the answers.
Design Document Sample Given two concentrated circles with different radii, calculate the area which falls inside the big circle but outside the small.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
An Introduction to Programming with C++1 Beginning the Problem- Solving Process Tutorial 2.
Do Now:. Circumference What is circumference? Circumference is the distance around a circle.
Circles. Parts of a Circle Center The diameter is the distance across the circle through the center The radius is the distance to the center point.
Flow Charts And Pseudo Codes Grade 12. An algorithm is a complete step-by- step procedure for solving a problem or accomplishing a task.
Lecture 3 Computer Programming -1-. The main steps of program development to solve the problem: 1- problem definition : The problem must be defined into.
CSE 110: Programming Language I Matin Saad Abdullah UB 404.
Lesson 8.7 Concept: How to find the circumference of a circle. Guidelines: *The diameter of a circle extends from one side of the circle to the other.
Every other Friday, employees of Burger King get paid. They receiver their hourly wage for every hour they worked. Uncle Sam taxes their earnings taking.
Lesson 2 Flowcharting.
Measurement π Discovering Pi
CS1001 Programming Fundamentals 3(3-0) Lecture 2
Algorithms and Flowcharts
Selection Structures (Part 1)
ALGORITHMS & FLOWCHARTING II
Circumference Definition: The distance around a circle. It’s a special word for perimeter. Picture:
CS110D Programming Language I
Understanding Problems and how to Solve them by using Computers
Miles to Kilometers problem
Presentation transcript:

CSEB114: Principle of programming Tutorial 1

Question 1 You are required to design a program that will computes and displays a circle’s area and circumference, given its radius. The program should repeatedly continue calculating and displaying the area and circumference until the user enter 0 for radius. Use pseudocode and flow chart. (Area=r2, Circumference=2r)

Answer Problem Analysis Input: radius Output: area and circumference of a circle Formula: Area=r2 Circumference=2r Constraint: none

Answer Pseudocode Begin Set pi = 3.14 Read radius, r Calculate Area = pi * r * r Calculate Circumference = 2 * pi * r Print Area and Circumference End

Answer Flowchart Begin Set pi = 3.14 Read radius, r Area= pi * r * r Circ= 2 * pi* r End Print Area and Circ

Question 2 You are assigned a job that requires you to study some maps that give distances in kilometres and some use miles. You prefer to deal in metric measurement. (Note: 1 mile = 1.609 km) Analyse the problem by identifying the input, output, constraints (if any) and the formula required to solve the problem Design an algorithm to solve the problem using pseudocode and flowchart diagram.

Answer Problem Analysis Input: distance miles Output: distance in kilometers Formula: kilometer = distance in mile * 1.609 Constraint: none

Answer Pseudocode Begin Read distance if distance is in miles kilometer = distance in miles * 1.609 end_if Print distance in kilometers End

Answer Flowchart Begin Read distance Distance in miles kilometer = distance in miles * 1.609 Print kilometer End yes no