Algorithms. Software Development Method 1.Specify the problem requirements 2.Analyze the problem 3.Design the algorithm to solve the problem 4.Implement.

Slides:



Advertisements
Similar presentations
Credit hours: 4 Contact hours: 50 (30 Theory, 20 Lab) Prerequisite: TB143 Introduction to Personal Computers.
Advertisements

1 ICS102: Introduction To Computing King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science.
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
Copyright © 2002 W. A. Tucker1 Chapter 1 Lecture Notes Bill Tucker Austin Community College COSC 1315.
Flow Control Analysis & Design Tool: Flowcharts
 Control structures  Algorithm & flowchart  If statements  While statements.
Math operators and a challenge Mastery Objectives: Students will— Be able to use augment assignment operators Demonstrate proficiency in using types, variables.
Software Development Method. Assignments Due – Homework 0, Warmup Reading – Chapter 2 –
Algorithms. Software Development Method 1.Specify the problem requirements 2.Analyze the problem 3.Design the algorithm to solve the problem 4.Implement.
Problem Solving and Program Design. COMP104 Problem Solving / Slide 2 Our First Program // a simple program #include using namespace std; int main() {
1 Lab-1 CSIT-121 Spring 2005 Lab Targets Solving problems on computer Programming in C++ Writing and Running Programs Programming Exercise.
Functions. A set of statements (lines of code) that can be run repeatedly Goals: Learning Python by Lutz and Ascher –Code reuse –Procedural decomposition.
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.
Java Intro. Strings “This is a string.” –Enclosed in double quotes “This is “ + “another “ + “string” –+ concatenates strings “This is “ “ string”
Functions. A set of statements (lines of code) that can be run repeatedly Goals: Learning Python by Lutz and Ascher –Code reuse –Procedural decomposition.
Algorithm Design CS105. Problem Solving Algorithm: set of unambiguous instructions to solve a problem – Breaking down a problem into a set of sub- problems.
1 Lab Assignment#5 Due 12/7 A car can hold 12 gallons of gasoline and it can travel 360 miles without refuelling. Write a program the displays the trip.
1 Lab-1 CSIT-121 Fall 2004 Lab Targets Solving problems on computer Programming in C++ Writing and Running Programs Programming Exercise.
CS 101 Problem Solving and Structured Programming in C Sami Rollins Spring 2003.
JavaScript with Input & Output Step 1: Use tags JavaScript Template.
BBS Yapısal Programlama (Structured Programming)1 From problem to program In “real world”… Problem in Natural language Top Down Design in pseudo-code.
Software Engineering 1 (Chap. 1) Object-Centered Design.
The fourth programming assignment J.-F. Pâris Fall 2014.
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Developing a Program.
Planning for the Solution
Programming.
Looping While-continue.
Chapter 2: Beginning the Problem-Solving Process
CS 127 Writing Simple Programs.  Stages involved  Analyze the problem  Understand as much as possible what is trying to be solved  Determine Specifications.
More Algorithm Design CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Verify Unit Of Measure In A Multivariate Equation © Dale R. Geiger
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Flowcharts.
Lecture 4: Calculating by Iterating. The while Repetition Statement Repetition structure Programmer specifies an action to be repeated while some condition.
B065: PROGRAMMING Sub Procedures I. Starter  Identify the separate tasks to be performed in the programming task below (break it down into numbered sections).
Software Development Method Reference : Problem Solving & Program Design in C ; Jeri R.Hanly, Elliot B.Koffman.
EXERCISES for ALGORITHMS WRITING
Basic problem solving CSC 111.
CS 100 Introduction to Computing Seminar
UFCEKS-20-2Multimedia Authoring Times Table Quiz.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
CS2006- Data Structures I Chapter 5 Linked Lists III.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake An Introduction to Programming.
Algorithm Discovery and Design Objectives: Interpret pseudocode Write pseudocode, using the three types of operations: * sequential (steps in order written)
The Hashemite University Computer Engineering Department
Algorithms, Part 3 of 3 Topics In-Class Project: The Box
1 Original Source : and Problem and Problem Solving.ppt.
UFCFY5-30-1Multimedia Studio Scripting for Interactive Media Times Table Quiz This will contribute towards your online portfolio for this module.
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,
Algorithms and Pseudocode
MIT App Inventor Lesson 3 Algorithms Variables Procedures.
PROBLEM SOLVING. REDBLUE GREENPINK ORANGEYELLOW Exit.
CSCI 161 Lecture 3 Martin van Bommel. Operating System Program that acts as interface to other software and the underlying hardware Operating System Utilities.
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.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
How Computers Solve Problems Computers also use Algorithms to solve problems, and change data into information Computers can only perform one simple step.
1 Structured Programming Arab Academy for Science and Technology CC112 Dr. Sherif Mohamed Tawfik The Course.
An Introduction to Programming with C++1 Beginning the Problem- Solving Process Tutorial 2.
Ni.com/training LabVIEW Basics I National Instruments N. Mopac Expressway Austin, Texas (512)
Exercise : Write a program that print the final price of purchase at a store where everything costs exactly one dollar. Ask for the number of items purchased.
Selection Structures (Part 1)
Lecture2.
Example Programs.
CC213 Programming Applications
PROBLEM SOLVING CSC 111.
Basic Lessons 5 & 6 Mr. Kalmes.
Basic Concepts of Algorithm
Hint idea 2 Split into shorter tasks like this.
Presentation transcript:

Algorithms

Software Development Method 1.Specify the problem requirements 2.Analyze the problem 3.Design the algorithm to solve the problem 4.Implement the algorithm 5.Test and verify the completed program 6.Maintain and update the program

Software Development Method 1.Specify the problem requirements In this class, often done for you 2.Analyze the problem Your job – what are the inputs and outputs 3.Design the algorithm to solve the problem Your job – write it down and turn it in! 4.Implement the algorithm Your job 5.Test and verify the completed program Your job – this is the most time consuming part Go back to step 4 if your program fails the tests 6.Maintain and update the program Always assume you will reuse your code at some point

Algorithms Step-by-step procedure for solving a problem Be as specific as possible – include all steps Example – doing your laundry

Calculate Tax on an Item Problem Analysis Algorithm design Implementation Testing Maintenance

#A program to calculate tax and total cost for an item. #determine rate of taxation #ask user for the cost of the item #calculate the tax #calculate total cost #display the results

#Name: Sami Rollins #A program to calculate tax and total cost for an item. #determine rate of taxation TAX_RATE =.0825 #ask user for the cost of the item cost = input("Enter item cost: ") #calculate the tax tax = cost*TAX_RATE #calculate total cost total = cost+tax #display the results print "Cost: ", cost print "Tax : ", tax print "Total: ", total

#Name: Sami Rollins #A program to calculate tax and total cost for an item. Indicates what the program does Comments –# to the end of the line Heading

#determine rate of taxation TAX_RATE =.0825 Sets the value of the variable TAX_RATE to be.0825 Variables

#ask user for the cost of the item cost = input("Enter item cost: ") Prompt the user for the cost of the item and store the response in the variable cost Input

#calculate the tax tax = cost*TAX_RATE Multiply the cost times the tax rate and store the result in the variable tax Calculation

#calculate total cost total = cost+tax Add the cost and the tax and store the result in the variable total Calculation

#display the results print "Cost: ", cost print "Tax : ", tax print "Total: ", total Display the results for the user Output

Exercises 1.Write the algorithm for a program that takes as input the number of miles a car has traveled and the number of gallons of gas the car has consumed and calculates the number of miles the car can travel on one gallon of gas.

Exercises 2.Write the program for the algorithm you just generated using the tax program as a template.