Design Document Sample Given two concentrated circles with different radii, calculate the area which falls inside the big circle but outside the small.

Slides:



Advertisements
Similar presentations
CHAPTER 5: Repetition Control Structure. Objectives  To develop algorithms that use DOWHILE and REPEAT.. UNTIL structures  Introduce a pseudocode for.
Advertisements

Chapter 04 (Part III) Control Statements: Part I.
 Control structures  Algorithm & flowchart  If statements  While statements.
Loops (Part 1) Computer Science Erwin High School Fall 2014.
Objectives In this chapter, you will learn about:
Introduction to working with Loops  2000 Prentice Hall, Inc. All rights reserved. Modified for use with this course. Introduction to Computers and Programming.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie July 5, 2005.
True BASIC Ch. 6 Practice Questions. What is the output? PRINT X LET X = -1 PRINT X FOR X = 4 TO 5 STEP 2 PRINT X NEXT X PRINT X END.
Switch structure Switch structure selects one from several alternatives depending on the value of the controlling expression. The controlling expression.
COMP 14 Introduction to Programming Miguel A. Otaduy May 20, 2004.
Section 3 - Selection and Repetition Constructs. Control Structures 1. Sequence 2. Selection 3. Repetition.
Repetition Statements Repeating an Action A specified number of times While a Condition is True Until a Condition is True.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Looping Exercises Deciding Which Loop to Use At this.
Loop Exercise 1 Suppose that you want to take out a loan for $10,000, with 18% APR, and you're willing to make payments of $1,200/month. How long will.
Chapter 2 - Algorithms and Design
Lecture 10: Reviews. Control Structures All C programs written in term of 3 control structures Sequence structures Programs executed sequentially by default.
CSEB114: Principle of programming
Logic Structure - focus on looping Please use speaker notes for additional information!
Repetition & Loops. One of the BIG advantages of a computer: ­It can perform tasks over and over again, without getting bored or making mistakes (assuming.
Programming Logic and Design Sixth Edition Chapter 5 Looping.
Chapter 5: Control Structures: Iteration Visual Basic.NET Programming: From Problem Analysis to Program Design.
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.
An Introduction to Programming with C++ Sixth Edition Chapter 7 The Repetition Structure.
Control Structures II Repetition (Loops). Why Is Repetition Needed? How can you solve the following problem: What is the sum of all the numbers from 1.
Lecture 4: Calculating by Iterating. The while Repetition Statement Repetition structure Programmer specifies an action to be repeated while some condition.
Chapter 5: Control Structures II J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design,
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 4 Looping.
Chapter 4: Control Structures II
 2008 Pearson Education, Inc. All rights reserved JavaScript: Control Statements I.
Advanced Program Design. Review  Step 1: Problem analysis and specification –Specification description of the problem’s inputs and output –Analysis generalize.
CSCI-100 Introduction to Computing
Lecture 5: Stopping with a Sentinel. Using a Sentinel Problem Develop a class-averaging program that will process an arbitrary number of grades each time.
Introduction to Loops For Loops. Motivation for Using Loops So far, everything we’ve done in MATLAB, you could probably do by hand: Mathematical operations.
Chapter 5: Control Structures: Iteration Visual Basic.NET Programming: From Problem Analysis to Program Design.
REPETITION STATEMENTS - Part2 Structuring Input Loops Counter-Controlled Repetition Structure Sentinel-Controlled Repetition Structure eof()-Controlled.
Chapter 7 Problem Solving with Loops
Algorithm Discovery and Design Objectives: Interpret pseudocode Write pseudocode, using the three types of operations: * sequential (steps in order written)
Copyright © 2012 Pearson Education, Inc. Chapter 5: Loops.
Topic: Control Statements. Recap of Sequence Control Structure Write a program that accepts the basic salary and allowance amount for an employee and.
Lecture 7 – Repetition (Loop) FTMK, UTeM – Sem /2014.
Lecture 5: Layers of Control. Nested while Loops Problem Multiplying two numbers and outputting the result only if they are both less than 5. (i.e. Start.
Selection Using IF THEN ELSE CASE Introducing Loops.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 3 - Structured Program Development Outline.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Flow Control (while) Outline 3.7The While Repetition.
CHAPTER 6: REPETITION AND LOOP STATEMENTS Learning outcomes  Define the concept of repetition structure.  Specify.
Looping I (while statement). CSCE 1062 Outline  Looping/repetition construct  while statement (section 5.1)
CHAPTER 2.2 CONTROL STRUCTURES (ITERATION) Dr. Shady Yehia Elmashad.
Trace Tables In today’s lesson we will look at:
CHAPTER 6: REPETITION AND LOOP STATEMENTS
CHAPTER 5A Loop Structure
Think What will be the output?
ALGORITHMS & FLOWCHARTING II
Computer Science 101 While Statement.
Control Structure Senior Lecturer
Introduction to pseudocode
JavaScript: Functions Part II
Global Challenge A bag for Juliane Lesson 2.
Global Challenge A bag for Juliane Lesson 2.
Let’s all Repeat Together
Inequalities and their Graphs
A LESSON IN LOOPING What is a loop?
Global Challenge A bag for Juliane Lesson 2.
Global Challenge A bag for Juliane Lesson 2.
Global Challenge A bag for Juliane Lesson 2.
Global Challenge A bag for Juliane Lesson 2.
Global Challenge A bag for Juliane Lesson 2.
Global Challenge A bag for Juliane Lesson 2.
Global Challenge A bag for Juliane Lesson 2.
Iteration – While Loops
Presentation transcript:

Design Document Sample Given two concentrated circles with different radii, calculate the area which falls inside the big circle but outside the small circle (cyan part in the graph) - to be continued … Specify the Requirement

Data Analysis NameTypeContent ConstantsPIreal3.14 VariablesradiusOfSmallCirclerealradius of the small circle radiusOfBigCirclerealradius of the big circle areaOfSmallCirclerealarea of the small circle areaOfBigCirclerealarea of the big circle areaToBeCalculated realarea of the requested part - to be continued …

Problem Analysis Prompt User for the input of radiusOfSmallCircle Read radiusOfSmallCircle Prompt User for the input of radiusOfBigCircle Read radiusOfBigCircle Calculate areaOfSmallCircle Calculate areaOfBigCircle Calculate areaToBeCalculated by substracting areaOfSmallCircle from areaOfBigCircle Output areaToBeCalculated - to be continued …

Algorithm (Pseudocode) print “Enter radius of the small circle: ” read radiusOfSmallCircle print “Enter radius of the big circle: ” read radiusOfBigCircle areaOfSmallCircle = PI * radiusOfSmallCircle * radiusOfSmallCircle areaOfBigCircle = PI * radiusOfBigCircle * radiusOfBigCircle areaToBeCalculated = areaOfBigCircle - areaOfSmallCircle print “the area to be calculated is: ”, areaToBeCalculated - to be continued …

Trace Table radiusOfSmallCircleradiusOfBigCircle areaToBeCalculated end.

Types of Statements - Sequential Statement Definition: Statements which are complete within themselves. These Statements neither iterate nor check conditions. e.g. 1. print “Enter radius of the small circle: ” 2. read radiusOfSmallCircle or get radiusOfSmallCircle or input radiusOfSmallCircle 3. areaOfSmallCircle = PI * radiusOfSmallCircle * radiusOfSmallCircle 4. output areaToBeCalculated or print areaToBeCalculated or write areaToBeCalculated

Types of Statements - Conditional Statement Defintion: Statements having a choice of operation expressed within them. if (condition) then perform operation (1) // condition is met else perform operation (2) // condition is not met e.g. if (gender = ‘M’) then print “Hello, Sir.” else print “Hello, Madam.” - to be continued …

Types of Statements - Conditional Statement If more choices are needed … e.g. if (CountryCode = ‘A’) then print “America” else if (CountryCode = ‘B’) then print “British” else if (CountryCode = ‘C’) then print “China” else if (CountryCode = ‘D’) then print “Denmark” else print “Sorry, I do not know the answer”

Types of Statements - looping/iterative Statement Definition: Statement which enforce repetition. Three MUST steps: -INITIALIZE the loop correctly -CONTINUE the loop correctly -STOP the loop correctly e.g. Print 10 times “Hello, World” count = 0 while (count = 10 begin print “Hello, World” // the operations to be repeated count = count +1 end - to be continued …

Types of Statements - looping/iterative Statement Counter-controlled loops: a count controls the loop until a limit is reached. Three MUST steps: -INITIALIZE the counter correctly -UPDATE the counter correctly -CHECK the counter to decide whether to CONTINUE or STOP repeating e.g. Print 10 times “Hello, World” count = 0 while (count = 10 begin print “Hello, World” // the operations to be repeated count = count +1 end - to be continued …

Types of Statements - looping/iterative Statement Sentinel-controlled loops: a variable’s value is chosen to end the loop. Three MUST steps: -INITIALIZE the variable correctly -UPDATE the variable correctly -CHECK the variable to decide whether to CONTINUE or STOP repeating e.g. Read employeeId until its value is equal to -1 read employeeId while (employeeId <>-1) // condition to STOP this loop is employeeId = -1 begin print “employeeId is ”, employeeId // the operations to be repeated read employeeId end - to be continued …