>> y1 = input('Please enter a number'); >> y2 = input('Please enter a letter'); >> y3 = input('Please enter a letter','s'); >> y4 = input('Please enter.

Slides:



Advertisements
Similar presentations
NFA: Vending Machine Simulation
Advertisements

Some problems for your consideration
For loops For loops are controlled by a counter variable. for( c =init_value;c
CS 112 Intro to Computer Science II Sami Rollins Fall 2006.
Branches and Loops Selim Aksoy Bilkent University Department of Computer Engineering
In Class Exercises. TV  Think about your television as an object.  You send messages to it using the remote control. What messages can you send?  What.
Finite State Machines Control Circuits Example: Vending Machine Takes only quarters and dollar bills Won't hold more than $1.00 Sodas cost $.75 Possible.
MTWTHF. MONEY Determines equivalent values of coins to $0.50. & $1.00 BILL Determines the value of a set of coins up to $0.50 using quarters, nickels,
Counting Currency For Special Education K-12 Next Slide.
EXIT © Joyce Gerald EXITMONEY: Determines equivalent values of coins to $0.50. & $1.00 BILL Determines the value of a set of coins up to $0.50 using.
I wonder who has more money…. 1 dollar, 3 nickels, 5 dimes 6 dimes, 3 pennies, 5 quarters 8 pennies, 6 nickels, 3 dimes 2 half dollars, 5 pennies, 8 nickels.
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.
C HANGES (P ROG 600 – 58 T ) AP Computer Science 2010 By: Chia-Hsuan Wu.
Problem Solving and Program Design in C (5th Edition) by Jeri R. Hanly and Elliot B. Koffman CPCS 202 Chapter 2 – Input/Output
Chapter 3 COMPLETING THE BASICS Programming Fundamentals with C++1.
$1 Million $500,000 $250,000 $125,000 $64,000 $32,000 $16,000 $8,000 $4,000 $2,000 $1,000 $500 $300 $200 $100 Welcome.
Algebra Jeopardy Expressions and Equations. Algebra Jeopardy Evaluate Distributive Property Simplify Connections Solve Real Life
Finite-State Machines with Output
1 Chapter 9 Additional Control Structures Dale/Weems/Headington.
E0001 Computers in Engineering Procedures: subprograms and functions.
Working with Money Grade 3 Math Lesson Mrs. Frederico.
Splash Screen. Lesson Menu Five-Minute Check (over Lesson 5–7) CCSS Then/Now Key Concept: Rational Zero Theorem Example 1:Identify Possible Zeros Example.
Money By: Rachel Morello Teacher Page Click here!
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 3: Numerical Data Manipulating Numbers Variables.
Additional Control Structures. Chapter 9 Topics Switch Statement for Multi-way Branching Do-While Statement for Looping For Statement for Looping Using.
Basic Money Skills Basic Consumer Math Lesson 1 Introduction Mrs. Stack.
Penny Nickel Dime Penny Nickel Dime Quarter Half Dollar.
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Who uses it?. We all use money to buy what we need to function in our world. Money Vocabulary Bills Dollars Coins Sliver Dollar Half Dollar Fifty Cent.
Counting Coins. The Basics Quarter 25 cents Dime 10 cents.
Permutations A CD has nine songs. In how many different orders could you play these songs? COURSE 3 LESSON 11-2 Simplify. 9! = = 362,880.
 M2N1. Students will use multiple representations of numbers to connect symbols to quantities  c. Use money as a medium of exchange. Make change and.
Canadian Money. Coins Penny 1 cent 1¢ Nickel 5 cents 5¢
Procedural Programming. Programming Process 1.Understand the problem 2.Outline a general solution 3.Decompose the general solution into manageable component.
Let’s Learn About Money!
Name the United States Coins Count the Pennies 10 ¢
MATH AND MONEY.
Relations A relation is a set of ordered pairs. Let's take a look at a couple of examples:
I CAN USE MULTIPLICATION TO CONNECT VOLUME WITH VOLUME AS FILLING. Module 5, Lesson 5.
Fall 2006AE6382 Design Computing1 Control Statements in Matlab Topics IF statement and Logical Operators Switch-Case Disp() vs fprintf() Input() Statement.
Adding and Subtracting Money! Click on the dollar sign to begin!
Programming Fundamentals with C++1 Chapter 3 COMPLETING THE BASICS.
Coins A small piece of metal, usually flat and circular, authorized by a government for use as money.
Factor and Solve Polynomial Equations 2.3 (GREEN book)
CMPS 1371 Introduction to Computing for Engineers CHARACTER STRINGS.
Chapter 3 The General Structure of Ada Programs. General Form of an Ada Program With package1; With package2;... With packagen; Procedure pname IS - -
1 Programming in C++ Dale/Weems/Headington Chapter 9 Additional Control Structures (Switch, Do..While, For statements)
Counting Quarters, Dimes, Nickels, and Pennies Click here to begin Click here to begin.
6-4 Solving Polynomial Equations. Objectives Solving Equations by Graphing Solving Equations by Factoring.
Assignments. Assignment 1 Write a program to calculate the current equation Where p is the period of pendulum in seconds, g=980 cm/sec 2 (acceleration),
GCSE Computing: Programming GCSE Programming Remembering Python.
Factoring Quadratic Expressions ax 2 + bx + c “SPLITTING THE MIDDLE” Feb. 27, 2014.
Overview Input Input statements Menu statements Output Display statements fprintf statements Message boxes.
Measurement. 1.1 Fundamentals of measurement Develop an operational definition for the length of an object. Select appropriate measuring devices. Use.
Money – Change Combinations &MathLine. Start with each ring representing a penny Money – Change.
Today we are going to talk about coins and their value! We will be finding out the value of pennies, nickels, dimes and quarters! Standards: MAFS.1.MD.2.a:
HOW CAN I CONVERT MONEY? MCC.4.MD.1 Money. Conversions ____ pennies = 1 nickel ____ nickels = 1 dime ____ dimes = 1 dollar ____ quarters = 1 dollar.
Algorithms 09/04/13. Algorithm Step-by-step process for solving a problem. Often described in pseudocode language. Unambiguous, Executable and Terminating.
Section 10.8 Factoring Using the Distributive Property
L2. Basics Variables and Expressions Assignment Statements
Sum and Product of Roots
Chapter 3: Expressions and Interactivity.
Begin at 5. Count by 5s to 100. Begin at 30. Count by 10s to 150.
OUTPUT STATEMENTS GC 201.
Name the United States Coins
Splash Screen.
CSC 111 Exam 3 Review Fall 2005.
Splash Screen.
Money Math Review.
Factoring Introduction
Presentation transcript:

>> y1 = input('Please enter a number'); >> y2 = input('Please enter a letter'); >> y3 = input('Please enter a letter','s'); >> y4 = input('Please enter a number','s'); Demo: input statements Input: 9 a 9

>> num = input('Please enter a number: '); >> name = input('Please enter your name: ','s'); >> fprintf('The number you''ve entered is %i',num); >> fprintf('The number you''ve entered is %i\n',num); >> fprintf('The number you''ve entered is %f\n',num); >> fprintf('The number you''ve entered is %0.2f\n',num); >> fprintf('The number you''ve entered is %8.2f\n',num); >> fprintf('Your name is %i\n',name); >> fprintf('Your name is %s\n',name); Demo: fprintf statements

Using input statements Problem 1: Write a script that will allow the user to enter the three coefficients of a quadratic expression (y = ax 2 + bx + c) and computes the roots of the polynomial. Problem 2: A metric ton is 35, ounces. Write a script that will allow the user to enter the weight of a box of cereal (in ounces) and compute the weight of the box of cereal in tons as well as how many boxes are needed to make one metric ton of cereal.

Using input statements Problem 3: You are the newest employee at VISA (Vending Innovations for Snacking Acquisition), and you have been put in charge of writing the new control system for the next wave of vending machines. Currently, the top-of-the-line model of vending machines produced by VISA only gives change in pennies. Before you implement your system on an actual vending machine, you need to do some testing. Write a script that will allow the user to enter the cost of the item and the amount of money entered and returns the least number of individual pieces of currency as change. The vending machine can return dollar bills, quarters, dimes, nickels, and pennies.

Write a script that will allow the user to select from a set of different dimensions for standard shipping boxes and return the volume and girth of each box. Menu Statements Dimensions: 1)L: 12” W: 12”H: 5.5” 2)L: 5.375” W: 8.675”H: 1.675” 3)L: 11” W: 8.5”H: 5.5” 4)L: ” W: 3.375”H: ” L W H girth

fprintf Statements Using fprintf statements, write a script that will display the lengths, widths, heights, volumes and girths for all 4 box options in a table format. Example Results: Length (in)Width (in)Height (in)Volume (in^3)Girth (in)

Useful String Functions When working with strings, there are two useful functions that can allow you to switch back and forth between numbers and strings: num2str(number) – converts a number from type double to the equivalent string of numbers str2double('string') – converts a string of number characters into a double value

Creating Strings Figure out 2 different ways to display the following statement: My name is X and I am Y years old. where X is a name entered by the user (using an input statement) and Y is the age entered by the user (using an input statement)