Program Planning & Design. Hierarchy Charts Salary Calculator Annual RaiseBonusLeaveDeductions One timeDistributed PaidUnpaidSick FixedOne time.

Slides:



Advertisements
Similar presentations
Lecture 10 Flow of Control: Loops (Part 2) COMP1681 / SE15 Introduction to Programming.
Advertisements

A Level Computing#BristolMet Session Objectives#U2 S2 MUST describe the steps of an algorithm using a program flowchart SHOULD explain the data types and.
Exercise (1).
CSE 1301 Lecture 5B Conditionals & Boolean Expressions Figures from Lewis, “C# Software Solutions”, Addison Wesley Briana B. Morrison.
Program Planning & Design Chapter 3. Steps in Program Planning & Design oUnderstand the problem oChoose and/or design appropriate algorithm oDevelop flow-chart.
Solving Problems with Repetition. Objectives At the end of this topic, students should be able to: Correctly use a while statement in a C# program Correctly.
Flow Charts, Loop Structures
PSEUDOCODE & FLOW CHART
Chapter 1 - An Introduction to Computers and Problem Solving
Chapter 2 - Problem Solving
Introduction to Flowcharting A Supplement to Starting Out with C++, 4th Edition by Tony Gaddis Published by Addison-Wesley.
Subject: Information Technology Grade: 10
Reference :Understanding Computers
Chapter 2 - Problem Solving
Basics of Computer Programming Web Design Section 8-1.
CSE 1301 Lecture 6B More Repetition Figures from Lewis, “C# Software Solutions”, Addison Wesley Briana B. Morrison.
PRESENTED BY NASIR ABBAS. FLOW CHART CONTENTS What is a flow chart? Flow chart symbols.
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering 3 October 2007.
Chapter 4 Loops Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved
Computer Science 1620 Programming & Problem Solving.
BBS Yapısal Programlama (Structured Programming)1 From problem to program In “real world”… Problem in Natural language Top Down Design in pseudo-code.
ALGORITHMS AND FLOW CHARTS 1 Adapted from the slides Prepared by Department of Preparatory year Prepared by: lec. Ghader Kurdi.
Chapter 1 Pseudocode & Flowcharts
PROGRAMMING In Lesson 5. RECAP  Complete the starter activity.
Lecture # 8 ALGORITHMS AND FLOWCHARTS. Algorithms The central concept underlying all computation is that of the algorithm ◦ An algorithm is a step-by-step.
1 Copyright (C) 2008 by Dennis A. Fairclough all rights reserved.
CSC141 Introduction to Computer Programming
Flow Charting. Goals Create Algorithms using Flow Charting procedures. Distinguish between Flow Charting and Pseudocode. Top-Down Design Bottom-up Design.
Outlines Chapter 3 –Chapter 3 – Loops & Revision –Loops while do … while – revision 1.
Design the program Create a detailed description of program –Use charts or ordinary language (pseudocode) Identify algorithms needed –Algorithm: a step-by-step.
PROGRAMMING LANGUAGES Prof. Lani Cantonjos. PROGRAM - set of step-by-step instructions that tells or directs the computer what to do. PROGRAMMING LANGUAGE.
First tutorial.
Lecture 4 Introduction to Programming. if ( grade ==‘A’ ) cout
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.
End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3.
Chapter 4 Selection Structures: Making Decisions.
By the end of this session you should be able to...
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Flowcharts.
Loops 1. Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved while Loop Flow.
Conditions. Objectives  Understanding what altering the flow of control does on programs and being able to apply thee to design code  Look at why indentation.
PSEUDOCODE C Programming Technique – Firdaus-Harun.com.
Programming with Microsoft Visual Basic th Edition
1 Program Planning and Design Important stages before actual program is written.
UFCEKS-20-2Multimedia Authoring Times Table Quiz.
Introduction to Computing Dr. Nadeem A Khan. Lecture 2.
Chapter 7 Problem Solving with Loops
The Hashemite University Computer Engineering Department
Topic: Control Statements. Recap of Sequence Control Structure Write a program that accepts the basic salary and allowance amount for an employee and.
Topics: Selection Statements. Processing Involving Selecting Instructions An instruction that allows deviation and selection to take place uses the ‘IF’
WHAT IS THIS? Clue…it’s a drink SIMPLE SEQUENCE CONTROL STRUCTURE Introduction A computer is an extremely powerful, fast machine. In less than a second,
Flowchart. a diagram of the sequence of movements or actions of people or things involved in a complex system or activity. a graphical representation.
Algorithms and Pseudocode
STEP 3- DEVELOP AN ALGORITHM At this stage we break down the problem into simple manageable steps so that they can be handled easily.
Solving Problems with Repetition Version 1.0. Objectives At the end of this topic, students should be able to: Correctly use a while statement in a C#
Program Program is a collection of instructions that will perform some task.
Flow Charts And Pseudo Codes Grade 12. An algorithm is a complete step-by- step procedure for solving a problem or accomplishing a task.
Algorithms and Flowcharts
A451 Theory – 7 Programming 7A, B - Algorithms.
CS1001 Programming Fundamentals 3(3-0) Lecture 2
Lecture 2 Introduction to Programming
Algorithm Algorithm is a step-by-step procedure or formula or set of instruction for solving a problem Its written in English language or natural language.
Programming Logic n Techniques
PROGRAMMING Program Development.
For Wednesday No new reading No quiz.
Flowcharts and Pseudo Code
Chapter 3: Selection Structures: Making Decisions
WJEC GCSE Computer Science
Introduction to Programming
Presentation transcript:

Program Planning & Design

Hierarchy Charts Salary Calculator Annual RaiseBonusLeaveDeductions One timeDistributed PaidUnpaidSick FixedOne time

Pseudo Code More human-language type Multiplication question 1.Generate a pair of random numbers ‘a’ and ‘b’ between 1 and 16. Ensure that this pair has not been used already. 2.Ask the user to enter the answer to a x b and save a & b 3.Give 3 chances to the user to answer correctly. Give the correct answer if the user failed in all attempts and record this pair as a repeated error. 4.Repeat 1 – 3 till the user types ‘END’. 5.Print all repeated error pairs with correct answers. Can you find a flaw?

Flow Charts Processing Step Terminator Start & End Connector Data In or Out Off page Connector Decision

Problem Understanding Get a pair of numbers from the user, add them and display the result on monitor. –Integer, Real or Complex numbers Representation of Complex numbers –Rectangular or polar representation? Divide a number by another number and write the result on monitor.

User Interface User of a computer is not necessarily a computer scientist or engineer –Make the users learn CS/CE?  –Who will hire CS/CE majors?  –Design programs that are user friendly –More jobs for CS/CE

Documentation Try to understand the following code T = A A = B B = T

Documentation Try to understand the following code ‘Select the bigger of the two numbers If (numberA < numberB) then choice = numberB Else choice = numberA End If Comment line

Example A factory gives a sale incentive to its dealers as follows. A monthly sale of Rs 5,000 is the break even point and is not eligible for any incentive. For the amount above Rs. 5,000 but below Rs. 20,000, the incentive is fixed at 5% of the “eligible amount”. The eligible amount is found by subtracting Rs. 5,000 from the monthly sale figure. Incentive rate steps up by 2% for every additional Rs 10,000 sale, beyond the Rs. 20,000 sale. The total incentive received by a dealer is capped at a yearly maximum of Rs. 19,900. Write a computer program that computes the monthly incentive for a dealer, given his/her sale amount for a month.

Solution: Incentive Calculations First MethodSecond Method If the total sale is above Rs. 20,000 in a month then use the highest rate to the total eligible amount. For example, a sale of Rs.39,000 has Rs34,000 as eligible amount. The maximum rate is 7%. Thus the incentive is Rs.2,380 for that month. Use 5% incentive rate on the eligible amount for sales up to Rs. 20,000. For a total sale beyond this use incremental incentive rate. For a sale of Rs. 39,000, we use 5% rate for the first Rs. 20,000 sale and 7% for the additional Rs. 19,000. Thus the total incentive is 5% of 15, % of 19,000 = ,330 = Rs.2,080

Incentive: Pseudo Code Get the name or identity of the dealer. Get YearIncentive given to that dealer so far and the MonthSale. Set MonthIncentive=0 If (YearIncentive is less than 19,900 AND MonthSale is more than 5000) then Calculate Incentive for current month TotalIncentive = YearIncentive + Incentive MonthIncentive=Incentive If (TotalIncentive > 19,900) MonthIncentive = 19,900- YearIncentive TotalIncentive = 19,900 End If YearIncentive=TotalIncentive Save YearIncentive End If Display MonthIncentive Stop

Flow Chart Start Read MonthSale & YearIncentive YearIncentive < 19,900 And MonthSale > 5000 MonthIncentive=0 Calculate Incentive and save results No Yes A B 1

Flow Chart Display MonthIncentive STOP 1