Functions, Part 3 of 4 Topics: Coding Practice Reading: None

Slides:



Advertisements
Similar presentations
CMSC 104, Version 9/011 Arithmetic Operators Topics Arithmetic Operators Operator Precedence Evaluating Arithmetic Expressions In-class Project Incremental.
Advertisements

 Algebra 1 Remediation September 3 Start on page 208 of practice packet.
Chapter 3 Planning Your Solution
Algorithms IV: Top-Down Design
Solid Figures: Volume and Surface Area Let’s review some basic solid figures…
Today, I will learn the formula for finding the area of a rectangle.
Chapter 1 Pseudocode & Flowcharts
How To Find Your Used Barcode Range for a Particular Vendor in Destiny.
Perimeter Is the sum of the lengths of the sides. When solving a perimeter problem, it is helpful to draw and label a figure to model the region.
Adapted from slides by Marie desJardins
CMSC 104, Version 9/01 1 The Box Problem: Write an interactive program to compute and display the volume and surface area of a box. The program must also.
Multiplying Polynomials
Math 5 Volume of Right Rectangular Prism Instructor: Mrs. Tew Turner.
PYTHON PROGRAMMING Week 10 – Wednesday. TERMS – CHAPTER 1 Write down definitions for these terms:  Computation  Computability  Computing  Artificial.
Surface Area of Prisms Math 10-3 Ch.3 Measurement.
Algorithmic Problem Solving CMSC 201 Adapted from slides by Marie desJardins (Spring 2015 Prof Chang version)
CMSC 104, Version 9/011 Incremental Programming Topics Review of Incremental Programming Example of Incremental Programming Reading None.
CMSC 104, Section 301, Fall Lecture 06, 9/18/02 Algorithms, Part 3 of 3 Topics Disk Quota Exceeded. Using Pine. More Algorithms Reading Read.
Arithmetic Operators Topics Arithmetic Operators Operator Precedence
Volume Performance Task Rectangular Prisms
Writing Program Code in BASIC Write a program to prompt for and accept values into TWO variables, numx and numy. The program should square the value stored.
CMSC 104, Version 9/01 1 Functions, Part 3 of 3 Topics: Coding Practice o In-Class Project: The Box o In-Class Project: Drawing a Rectangle Reading: None.
1 Algorithms Practice Topics In-Class Project: Tip Calculator In-Class Project: Drawing a Rectangle.
CMSC 104, Version 8/061L10ArithmeticOps.ppt Arithmetic Operators Topics Arithmetic Operators Operator Precedence Evaluating Arithmetic Expressions In-class.
Warm-Up #1 11/30 1. Write down these 3 formulas:
The ‘while’ loop ‘round and ‘round we go.
Algorithms, Part 3 of 3 Topics In-Class Project: The Box
Intro to Loops 1.General Knowledge 2.Two Types of Loops 3.The WHILE loop 1.
Make a Model A box company makes boxes to hold popcorn. Each box is made by cutting the square corners out of a rectangular sheet of cardboard. The rectangle.
VOLUME What is Volume?  Volume is the measure of the capacity of a container.
+ Pyramids and Prisms. + Solid An object with 3 Dimensions Height, Width, Length.
Chapter 3 Orthographic Projection. TOPICS Object representation Glass box concept Line convention Orthographic projection of point, line, plane, surface.
What does it mean to find the volume of a solid? For example:
Squared and Cubed Conversion Factors
CMSC 104, Version 8/061L16IncrementalProg.ppt Incremental Programming Topics Review of Incremental Programming Example of Incremental Programming Reading.
Arithmetic Operators Topics Arithmetic Operators Operator Precedence
2008/09/22: Lecture 6 CMSC 104, Section 0101 John Y. Park
2.2 Multiply Polynomials Multiply a monomial and a polynomial
Solid Figures 7th Grade Standard
Chapter 5: Control Structure
solve the following problem...
2008/09/24: Lecture 6b CMSC 104, Section 0101 John Y. Park
VOLUME.
VOLUME.
The while Looping Structure
2008/11/12: Lab 5/Lecture 17 CMSC 104, Section 0101 John Y. Park
VOLUME.
Objective - To identify how perimeter and area relate.
2.2 Multiply Polynomials Multiply a monomial and a polynomial
Factoring to Solve Quadratic Equations
VOLUME.
The while Looping Structure
ME 142 Engineering Computation I
Algorithms, Part 3 of 3 Topics In-Class Project: The Box
Solutions to In-Class Problems
Algorithms Practice Topics In-Class Project: Tip Calculator
Question One Boxed In Question Two 25cm2 12cm2
Functions, Part 4 of 4 Topics: Coding Practice Reading: None
Part 6 Q26 to Q30 of National 5 Prelim
VOLUME.
Photoshop: Image size and resolution
Functions, Part 3 of 3 Topics: Coding Practice Reading: None
UMBC CMSC 104 – Section 01, Fall 2016
Use the Chain Rule to find {image} {image}
The while Looping Structure
Mod 38 F.
The while Looping Structure
VOLUME.
Algorithms, Part 3 of 3 Topics In-Class Project: Tip Calculator
Area of combined shapes
Presentation transcript:

Functions, Part 3 of 4 Topics: Coding Practice Reading: None In-Class Project: The Box In-Class Project: Drawing a Rectangle Reading: None CMSC 104, Version 8/06

Coding Practice Let’s take the algorithms that we developed in “Algorithms, Part 3 of 3”, modularize them, and code them. First, let’s review the algorithms. Remember they are as a single monolithic program, not taking advantage of a key concept, functions! CMSC 104, Version 8/06

The Box Problem: Write an interactive program to compute and display the volume and surface area of a box. The program must also display the box dimensions. Error checking should be done to be sure that all box dimensions are greater than zero. CMSC 104, Version 8/06

The Box - Pseudocode Display “Enter the height: “ Read <height> While (<height> <= 0 ) Display “The height must be > 0” End_while CMSC 104, Version 8/06

The Box - Pseudocode (con’t) Display “Enter the width: “ Read <width> While (<width> <= 0 ) Display “The width must be > 0” End_while CMSC 104, Version 8/06

The Box - Pseudocode (con’t) Display “Enter the depth: “ Read <depth> While (<depth> <= 0 ) Display “The depth must be > 0” End_while CMSC 104, Version 8/06

The Box - Pseudocode (con’t) <volume> = <height> X <width> X <depth> <surface1> = <height> X <width> <surface2> = <width> X <depth> <surface3> = <height> X <depth> <surface area> = 2 X (<surface1> + <surface2> + <surface3>) CMSC 104, Version 8/06

The Box - Pseudocode (con’t) Display “Height = “, <height> Display “Width = “, <width> Display “Depth = “, <depth> Display “Volume = “, <volume> Display “Surface Area = “, <surface area> CMSC 104, Version 8/06

Drawing a Rectangle Problem: Write an interactive program that will draw a solid rectangle of asterisks (*). The program must also display the dimensions of the rectangle. Error checking must be done to be sure that the dimensions are greater than zero. CMSC 104, Version 8/06

The Rectangle - Pseudocode Display “Enter the height: “ Read <height> While (<height> <= 0 ) Display “The height must be > 0” End_while CMSC 104, Version 8/06

The Rectangle - Pseudocode (con’t) Display “Enter the width: “ Read <width> While (<width> <= 0 ) Display “The width must be > 0” End_while CMSC 104, Version 8/06

The Rectangle - Pseudocode (con’t) Display “Height = “, <height> Display “Width = “, <width> Skip a line CMSC 104, Version 8/06

The Rectangle - Pseudocode (con’t) <height counter> = 1 While ( <height counter> <= <height> ) <width counter> = 1 While ( <width counter> <= <width> ) Display “*” <width counter> = <width counter> + 1 End_while Place cursor on next line <height counter> = <height counter> + 1 CMSC 104, Version 8/06