Lab 8 Basic Design and Documentation. Learn about top-down design and how to document your code properly. Look at a design diagram to figure out how to.

Slides:



Advertisements
Similar presentations
Lab III – Linux at UMBC.
Advertisements

NFA: Vending Machine Simulation
1 CSC 551: Web Programming Spring 2004 client-side programming with JavaScript  scripts vs. programs  JavaScript vs. JScript vs. VBScript  common tasks.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 14 – Student Grades Application: Introducing.
Chapter 61 Post Test Loop Do statement(s) Loop Until condition Loop is executed once and then the condition is tested. If it is False, the loop is run.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 8 - Interest Calculator Application: Introducing.
Program design example Task: Develop an algorithm expressed in pseudocode for a specified problem specified problem.
Method exercises Without IF. Setup Create one new project to hold all of these. In that project, create an empty class called WorkIt to hold all of your.
1 CSC 1401 S1 Computer Programming I Hamid Harroud School of Science and Engineering, Akhawayn University
Chapter 1 Program Design
Topic 4 – Programmer- Defined Functions. CISC 105 – Topic 4 Functions So far, we have only seen programs with one function, main. These programs begin.
CHAPTER 6 ELECTRONIC DATA PROCESSING SYSTEMS
1 AQA ICT AS Level © Nelson Thornes 2008 Testing a solution.
4-1 Coding Complete COBOL Programs: The PROCEDURE DIVISION Chapter 4.
4-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
1 Chapter 4. To familiarize you with methods used to 1. Access input and output files 2. Read data from an input file 3. Perform simple move operations.
Chapter 1 Introduction to VBA Development in Excel.
General Programming Introduction to Computing Science and Programming I.
VIENNA DEVELOPMENT METHOD -II. Improving the Incubator System  The software will not only record the current temperature of the system, but will also.
CMSC 104, Version 9/011 Incremental Programming Topics Review of Incremental Programming Example of Incremental Programming Reading None.
STRINGS CMSC 201 – Lab 3. Overview Objectives for today's lab:  Obtain experience using strings in Python, including looping over characters in strings.
System Analysis and Design
Practice and Evaluation. Practice Develop a java class called: SumCalculator.java which computes a sum of all integer from 1 to 100 and displays the result.
1 Chapter-01 Introduction to Software Engineering.
TA SURVEY Have the TA write their name on the board Fill out the survey at: The TA should walk out 5 minutes.
Chapter 4: Subprograms Functions for Problem Solving Mr. Dave Clausen La Cañada High School.
1 Chapter-01 Introduction to Software Engineering.
1 Flight Times. 2 Problem Specification 3 Additional Specifications You may assume that the input is a valid 24 hour time. Output the time entered by.
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.
1 5.4 Modular Design Top-Down Design Structured Programming Advantages of Structured Programming.
Software Engineering Object-Centered Design. Problem Solving Does anyone scuba dive? Let’s solve this scuba-diving problem: Write a program that, given.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Implementing and Using the SIRWEB Interface Setup of the CGI script and web procfile Connecting to your database using HTML Retrieving data using the CGI.
1. FINISHING FUNCTIONS 2. INTRODUCING PLOTTING 1.
A brief introduction to javadoc and doxygen. What’s in a program file? 1. Comments 2. Code.
Online Catalog Tutorial. Introduction Welcome to the Online Catalog Tutorial. This is the place to find answers to all of your online shopping questions.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Homework #2: Functions and Arrays By J. H. Wang Mar. 24, 2014.
José Aponte Public Health Advisor Module 3: Adding Intelligence to Forms 12 June 2012 Epi Info™ 7 Introductory Training Office of Surveillance, Epidemiology,
1 Chapter-01 Introduction to Software Engineering.
9. ITERATIONS AND LOOP STRUCTURES Rocky K. C. Chang October 18, 2015 (Adapted from John Zelle’s slides)
1 Project 7: Looping. Project 7 For this project you will produce two Java programs. The requirements for each program will be described separately on.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
CMSC 104, Section 301, Fall Lecture 18, 11/11/02 Functions, Part 1 of 3 Topics Using Predefined Functions Programmer-Defined Functions Using Input.
© 2012 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 3: Top-Down Design with Functions Problem Solving & Program.
Functions. What is a Function?  We have already used a few functions. Can you give some examples?  Some functions take a comma-separated list of arguments.
CMSC 104, Version 8/061L16IncrementalProg.ppt Incremental Programming Topics Review of Incremental Programming Example of Incremental Programming Reading.
DEVRY CIS 170 C I L AB 5 OF 7 A RRAYS AND S TRINGS Check this A+ tutorial guideline at
Repetitive Structures
An Introduction to Programming with C++ Sixth Edition
Quiz # 02 Design a data type Date to hold date
Fundamentals of Programming I Design with Functions
Functions CIS 40 – Introduction to Programming in Python
Intro to PHP & Variables
Reliance Supplier Corrective Action Process
Introduction to javadoc
To submit invoices; select
One-Dimensional Array Introduction Lesson xx
Incremental Programming
ASSIGNMENT OBJECTIVES
Learning Objectives Identify different types of event to start and stop loops Decompose a simple problem to help design a program Use abstraction to identify.
Looping III (do … while statement)
Examples Example Problems, their Algorithms, and their C Source Code.
Introduction to javadoc
Custom Functions in Power Query
Chapter 7: Input Validation
Python Basics with Jupyter Notebook
CHAPTER 6 ELECTRONIC DATA PROCESSING SYSTEMS
Incremental Programming
Switch Case Structures
Presentation transcript:

Lab 8 Basic Design and Documentation

Learn about top-down design and how to document your code properly. Look at a design diagram to figure out how to break a large problem down into manageable sub-problems. Be able to program incrementally. Goals

Change into the lab8 folder in your cs201/labs directory and create a lab8.py cd 201/labs cd lab8 emacs lab8.py & Step 0: Setup

Create a program which simulates a vending machine. Inventory: –Pepsi- Tortilla Chips- Mint Gum –Sprite- Knives- Bubble Gum –KoolAid- Forks- Doritos All inventory start at 5 items each. Program Objectives

Design Diagram

Write top-level functions These are functions that are easy to take care of without testing –printGreeting() –getValidInt () On next slide –Write stubs for other necessary functions Step 1

def getValidInt(question, min, max): # use a bad value to enter the loop value = max + 1 # compose the prompt prompt = question + " (" + str(min) + "-" + str(max) + "): " # continue to get values until the user enters a valid one while value == "" or value max: value = input(prompt) if len(value) != 0: value = int(value) # return a valid value return value getValidInt() # Filename: getValidInt.py # Author: Sue Evans # Date: 8/9/09 # Section: All # # Description: This program illustrates use of a while # loop to get values from the user within # a specified range, rejecting all bad input. # The function uses a post-test loop.

Go through the design diagram and determine the required functions along with the function parameters. Since each function is separate, independent testing can be (and should be) preformed before integrating it into the main program. Not all functions need to be complete to be able to run lab8.py –You accomplish this via a function stub. –At the end of the function, return nothing. Filling in the Other Functions

201 coding standards must be present for full credit. # findCircleArea() calculates the area of a circle with the # radius passed in # Input: the circle's radius # Output: the circle's area findCircleArea(): return Documentation: Function Headers

Fill in the other functions to make the rest of the vending machine to work appropriately. Correctly document your code with function headers and inline comments Lab completion will be based on how well designed your code is, not how complete it is Completing the lab