Chapter 1 Program Development

Slides:



Advertisements
Similar presentations
1 ICS102: Introduction To Computing King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science.
Advertisements

Chapter 1 - An Introduction to Computers and Problem Solving
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 1 Program Design
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Moving To Code 3 More on the Problem-Solving Process §The final step in the problem-solving process is to evaluate and modify (if necessary) the program.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
6 Steps of the Programming Process
© The McGraw-Hill Companies, 2006 Chapter 1 The first step.
Chapter 1 Program Development Asserting Java © Rick Mercer.
Lecture 2 Fundamental Data Types. Variable Declaration.
Computer Programming TCP1224 Chapter 3 Completing the Problem-Solving Process and Getting Started with C++
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Problem Solving using the Science of Computing MSE 2400 EaLiCaRA Spring 2015 Dr. Tom Way.
IXA 1234 : C++ PROGRAMMING CHAPTER 1. PROGRAMMING LANGUAGE Programming language is a computer program that can solve certain problem / task Keyword: Computer.
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.
Chapter 1 Program Development Asserting Java © Rick Mercer.
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.
Pseudocode. Simple Program Design, Fourth Edition Chapter 2 2 Objectives In this chapter you will be able to: Introduce common words, keywords, and meaningful.
Procedural Programming. Programming Process 1.Understand the problem 2.Outline a general solution 3.Decompose the general solution into manageable component.
Coding Design Tools Rachel Gauci. Task: Counting On Create a program that will print out a sequence of numbers from "1" to a "number entered”. Decision’s.
Chapter 5: Control Structures II J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design,
CS221 Algorithm Basics. What is an algorithm? An algorithm is a list of instructions that transform input information into a desired output. Each instruction.
Chapter 4 Software. Chapter 4: Software Generations of Languages Each computer is wired to perform certain operations in response to an instruction. An.
COIT29222 Structured Programming 1 COIT29222-Structured Programming Lecture Week 02  Reading: Textbook(4 th Ed.), Chapter 2 Textbook (6 th Ed.), Chapters.
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
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 4: Introduction to C: Control Flow.
PROBLEM SOLVING. What is a Problem? A problem is a situation that needs to be resolved.
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
CSE 110: Programming Language I Matin Saad Abdullah UB 404.
11 Making Decisions in a Program Session 2.3. Session Overview  Introduce the idea of an algorithm  Show how a program can make logical decisions based.
Programming revision Revision tip: Focus on the things you find difficult first.
Chapter 1: Introduction to Computers and Programming
CompSci 230 S Programming Techniques
Software Development.
Understand Problem Solving Tools to Design Programming Solutions
Computer Science Department
A451 Theory – 7 Programming 7A, B - Algorithms.
INTRODUCTION TO PROBLEM SOLVING
Software Development Expansion of topics page 28 in Zelle
Completing the Problem-Solving Process
Objectives You should be able to describe: Interactive Keyboard Input
DDC 1023 – Programming Technique
Programming Mehdi Bukhari.
Chapter 5: Control Structures II
Understand Problem Solving Tools to Design Programming Solutions
Repetition-Counter control Loop
Algorithm and Ambiguity
Understand the Programming Process
Comp Sci 200 Programming I Jim Williams, PhD.
Chapter 1: Introduction to Computers and Programming
BIT115: Introduction to Programming
Introduction to pseudocode
Programming Fundamentals (750113) Ch1. Problem Solving
Coding Concepts (Basics)
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Understand the Programming Process
Algorithm and Ambiguity
Problem Solving.
Chapter 1 Problem Solving with C++
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
Chapter 2 – part a Brent M. Dingle Texas A&M University
Basic Concepts of Algorithm
Module 4 Loops and Repetition 9/19/2019 CSE 1321 Module 4.
Programming Logic and Design Eighth Edition
Introduction to Programming
Presentation transcript:

Chapter 1 Program Development Asserting Java © Rick Mercer

Outline Goals Understand an example of program development Understand the characteristics of a good algorithm Understand how algorithmic patterns can help design programs

Program Development One program development strategy has these three steps: Analysis: Understand the problem Design: Organize the solution Implementation: Get the solution running Program development is the progression from analysis to design to implementation We'll see deliverables from all three phases deliverable: An item that indicates progress was made

Deliverables Analysis deliverable Design deliverable A list of variable names and some test cases Design deliverable An algorithm that outlines a solution Implementation deliverable An executable program

Analysis Synonyms for analysis Activities inquiry, examination, study Read and understand the problem statement. Name the pieces of information necessary to solve the problem these data names are part of the solution

Problem Need a program to compute the course grade ___________________ Name the data needed to compute an answer ___________________ ____________________ Name data to store the answer _____________

There is more to data than just names The data are stored in variables Each variable that stores numeric data has a name has a value can be used in a variety of operations such as storing different values into the variable multiply *, divide /, add +, and subtract retrieve the value to be used in expressions display the value

To input or output? It help in the early programs if data is distinguished either as input or as output Input Information the user must supply to solve the problem Output Information the computer must display after the processing has occurred

Test cases help us understand the problem A test case includes specific input data, and the output it should generate Problem: Find wholesale price given the markup and retail prices Test Case 1 markup 1.0 Input (1.0 represents 100%) retailPrice 100.00 Input wholesalePrice 50.00 Output Test Case 2 markup 0.5 Input (0.5 represents 50%) retailPrice 100.00 Input wholesalePrice 66.67 Output

Summary of Analysis Things to do during analysis Read and understand the problem Pick variable names that represent the answer This is the output Decide what data the user must enter to get the answer—the input (the unknowns) Develop some test cases Create a document that summarizes the analysis

Other Problems as Analysis Deliverables

Design Synonyms of design: model, think, plan, devise, pattern, propose, outline We'll use these design tools: algorithms algorithmic patterns

Algorithms An algorithm is a set of activities that solves a problem An algorithm must: list activities that must be performed list the activities in the proper order

Algorithm to Bake a Cake A recipe (a.k.a. an algorithm) Preheat Oven Grease Pan Mix ingredients Place ingredients into pan place pan in oven remove pan after 35 minutes Switch some activities around ... what happens if …

Algorithmic Patterns Pattern: Anything shaped or designed to serve as a model or guide in making something else Algorithmic Pattern: Serves as a guide to help develop programs It represents a common type of action that occurs over and over again in programs A solution that can be used different contexts The Input/Process/Output (IPO) Pattern can be used This IPO pattern will be used in our first project

IPO Algorithmic Pattern Pattern: Input/Process/Output (IPO) Problem: The program requires input data to generate the desired information Outline: 1. obtain input data from user 2. process input data 3. output the results

Patterns ala Alexander "Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice." From A Pattern Language, Christopher Alexander, Oxford University Press, 1977

Example of Algorithm Design The design deliverable will be an algorithm The IPO patterns provides a guide to design a more specific algorithm (that is a bit sketchy) IPO Model IPO applied to Chapter 1 Case Study I)nput Obtain the items that count for 127A's P)rocess Compute the course grade O)utput Display the course grade

Refining Activities in algorithms We often need to refine one or more activities (algorithm steps). For example, Compute the course grade might now be refined with the mathematical addition + and multiplication * symbols

Implementation Synonyms for Implementation accomplishment, making good, execution Implementation deliverable: computer program

Example Translations Here are some pseudocode algorithm step translated into the Java programming language Display the value of courseGrade System.out.println("Course grade: " + courseGrade); Obtain test1 Tell user what you want, then "read" it in Scanner keyboard = new Scanner(System.in); System.out.print("Enter test one: "); int test1 = keyboard.nextDouble(); Code Demo: Implement the Java Program

compile, correct, run, test, compile, correct run, test, correct, run, test, test, test ... Once the algorithm is translated into a programming language abstraction: use the compiler to generate byte code you will have errors so you'll need to fix errors, compile, and repeat until there are no compile time errors use the Java virtual machine to execute program test the program run the program several times with different sets of input data based on sample problems from analysis compare program output to expected results fix your program if it doesn't work

Testing Testing occurs at any point in program development: Analysis: think of some test cases Design: step through the algorithm Implementation: run program with several sets of input data A running program isn't always right however, testing provides confidence that it works correctly