Prerequisites: Read all chapters through Chapter 4 in the textbook before attempting this lab. Read through this entire assignment before you begin.

Size: px
Start display at page:

Download "Prerequisites: Read all chapters through Chapter 4 in the textbook before attempting this lab. Read through this entire assignment before you begin."

Transcription

1 Assignment Number 5 Lab Assignment Due Date: Wednesday, October 3, 2018 LAB QUESTIONS Due Date: before Monday, October 8, 2018 before 5:00 PM CS 1057 C Programming - Fall 2018 Purpose: write a complete program to perform multiple calculations use an IF statement create your own functions to break a complicated problem into smaller, manageable, pieces prove you understand how functions communicate Prerequisites: Read all chapters through Chapter 4 in the textbook before attempting this lab. Read through this entire assignment before you begin. Problem Specification: Create a program to process cash change using standard U.S. denominations of pennies, nickels, dimes, quarters, dollar bills, five-dollar bills, tens, and twenties. Figure out how many of each bill or coin that you expect to get back for a given amount. For example, if you need to give back $3.87 in change, you would have 3 one-dollar bills 3 quarters 1 dime 2 pennies The Fun Twist! Sometimes, you don't have all the denominations available in your cash drawer a shortage of one of the denominations! Write your program to allow for being out of a denomination or multiple denominations: dimes, for example. In that case, the $3.87 ends up being 3 ones, 3 quarters, 2 nickels and 2 pennies.

2 Tasks: 1) Use the function you created in the previous lab assignment to output the program tag line when it starts running. Adjust it by editing the source code for this program. In the future, we'll use the inputs to avoid changing the C code, but for this one, just edit it. 2) This program MUST be written in small steps. Write some code, compile, and test run. Repeat as necessary. DO NOT try and write this entire program all at once. First Part You should be able to do this first part without using any IF statements. If you're using IFs here, you're doing it incorrectly. Create a source code file called lab5.c. Write your program to handle the situation where there is no shortage and you have all the coins and bills available. Create a function to prompt the user to enter an amount. This function should be named prompt_user_for_amount( ). Create another function called calculate_change( ), which takes one input parameter, the amount of money needed to give back, and then one output parameter for each of the eight denominations, giving 9 parameters in total. Then write a function to print the results, print_change( ), with the eight denominations as parameters. Validate your program works by running it (and scripting the output) with the following amounts: 1) ) ) ) ) Save the script, and this version of your program, to separate files. Mail them together with the next part.

3 Second Part Copy your source code to a new file to modify. cp lab5.c lab5_part2.c Create a function to prompt the user to ask for shortages, after the user enters the amount. This should be a separate function, called prompt_for_shortages( ), that takes a string to use for a prompt and returns the one that's missing, using the symbolic constants below. The prototype should look like the following: int prompt_for_shortages( char *prompt ); You will need to invoke this function three times, giving the user an opportunity to identify which denomination is missing. We will use the following codes to represent the various denominations in the program, and these codes are what the function prompt_for_shortages( ) will return. If there are no missing denominations, all three of these return parameters will be NO_MISSING. #define NO_MISSING 0 #define MISSING_PENNIES 1 #define MISSING_NICKELS 2 #define MISSING_DIMES 3 #define MISSING_QUARTERS 4 #define MISSING_DOLLARS 5 #define MISSING_FIVES 6 #define MISSING_TENS 7 #define MISSING_TWENTIES 8 Now you can add IF statements to the program, to check to see if any given denominations are missing. To make sure your program is working correctly, create a script of the output using the same values from the first part above, but this time, eliminate 1) dollars and dimes 2) fives, dimes, and nickels 3) twenties and pennies

4 Helpful Hints: DESK CHECK You should desk check your algorithm to insure you know what's happening at all points in your program.walk through you code line by line and confirm you're doing the math you think you're doing. ROUNDING HURTS DOUBLES AND FLOATS Floating point numbers are subject to rounding, which could hurt your ability to accurately count the pennies in your program. Consider using INTs for all calculations to avoid rounding issues. INERACTIVE PROMPTING Make sure your prompting the user clearly for what input you need. ECHO PRINT You should echo print your input to confirm you're reading in what you think you're reading in. PRINT CALCULATIONS You may want to display your in-progress calculations when writing your program, to make sure you're calculating the values correctly. SAVE YOUR WORK Once the program works correctly, be sure to make a COPY of your work on a flash drive or by ing your code to another computer. Remember: You are responsible for keeping copies of your code. NOTE: The final version of your code may still print out the intermediate calculations, just to show all of your work to the lab instructor.

5 Questions: Answer the following questions about the source code above. Bring the answers to class on the due date to discuss. your answers to before the due date and time. 1. Explain what is meant by short-circuit evaluation. Where would you use this? 2. Why are compound statements useful in C IF statements? 3. What would the limitations be on programming if we didn't have control structures? 4. Explain the difference between a condition and a logical expression. 5. How does the compiler differentiate between a unary operator and a binary operator when used in a C statement like the following Explain your answer. computed = 7 * - n How does the compiler calculate the following condition? Explain your answer. if ( alpha beta && gamma ) 7. Explain the difference between "A" and 'A' in C source code. 8. Explain in 30 words or less what makes a cohesive function? 9. The following C code checks if color is 4 and if the size is 2, 4, or 6, but it doesn't work. Why? int size = 4; int color = 9; if ( color == 4 length == 2 == 4 == 6 ) { puts( "The size and color are correct!" ); }

6 10. Given the following: printf( "Enter your age in years: " ); scanf( "%d", &age_in_years ); int is_voting_age = ( age_in_years >= 18 ); int is_drinking_age = ( age_in_years >= 21 ); int can_be_president = ( age_in_years >= 35 ); int is_senior_citizen = ( age_in_years >= 65 ); a) When the age entered is 33, what are the values of the variables above? b) When the age entered is 12, what are the values of the variables above? c) Write an IF statement in a function to print 'Yes' for each value above that is true. 11. What is pseudocode? Explain where you might use it. 12. Write an expression to test for each of the following relationships: a. age is from 18 to 21, inclusive. b. water_temperature is less 92.7 but greater than c. year is divisible by 4. d. speed is not greater than 55. e. x is greater than y but not larger than c. f. w is not equal to 3, 6, or 10, and less than maximum. 13. Complete programming problems 1 through 4 on page of the textbook.

7 Grade Calculation: 20% - Code compiles without errors 40% - Code is properly commented and indented, uses step-by-step calculations, not one big calculation, with functions commented as documented on the web site and including appropriate names for the variables 20% - Script file is included and shows all input and output performed by the program 20% - Code runs correctly and generated correct output For each day the lab is late, 5% will be taken off. Note: The questions are graded separately and count towards the classroom participation grade.

Instructions PLEASE READ (notice bold and underlined phrases)

Instructions PLEASE READ (notice bold and underlined phrases) Assignment 2 Writing Basic Java Programs Required Reading Java Foundations Chapter 2 Data and Expressions Chapter 3 Sections 3.1-3.2, 3.4-3.7 Chapter 4 Sections 4.2-4.5, 4.7-4.8 Instructions PLEASE READ

More information

Marking rubric for Assignment #2

Marking rubric for Assignment #2 Marking rubric for Assignment #2 The TAs marked the following sections: Yu: Section A Questions -4, Section B Questions -3 Megan: Section B Questions 4-5 Assignment #2 Marking Rubric: A. WriteUp Please

More information

Assignment Number 8 Lab Assignment Due Date: Wednesday, October 31, 2018 CS 1057 C Programming - Fall 2018

Assignment Number 8 Lab Assignment Due Date: Wednesday, October 31, 2018 CS 1057 C Programming - Fall 2018 Assignment Number 8 Lab Assignment Due Date: Wednesday, October 31, 2018 CS 1057 C Programming - Fall 2018 Purpose: create a batch program use a version control system to obtain data (git) read and process

More information

pset1: C Tommy MacWilliam Grading Getting Started pset1: C Style Pennies Greedy Chart September 11, 2011

pset1: C Tommy MacWilliam Grading Getting Started pset1: C Style Pennies Greedy Chart September 11, 2011 tmacwilliam@cs50.net September 11, 2011 Today s Music 3OH!3 Deja Vu Hey See you Go Streets of Gold Axes scope: does it have everything? correctness: does it work? design: how efficiently does it work,

More information

Project 1: How to Make One Dollar

Project 1: How to Make One Dollar Project Objective: Project 1: How to Make One Dollar Posted: Wednesday February 16, 2005. Described: Thursday February 17, 2005. Due: 11:59PM, Sunday March 6, 2005. 1. get familiar with the process of

More information

CpSc 1011 Lab 3 Integer Variables, Mathematical Operations, & Redirection

CpSc 1011 Lab 3 Integer Variables, Mathematical Operations, & Redirection CpSc 1011 Lab 3 Integer Variables, Mathematical Operations, & Redirection Overview By the end of the lab, you will be able to: declare variables perform basic arithmetic operations on integer variables

More information

Gateway Regional School District VERTICAL ARTICULATION OF MATHEMATICS STANDARDS Grades K-4

Gateway Regional School District VERTICAL ARTICULATION OF MATHEMATICS STANDARDS Grades K-4 NUMBER SENSE & OPERATIONS K.N.1 Count by ones to at least 20. When you count, the last number word you say tells the number of items in the set. Counting a set of objects in a different order does not

More information

CpSc 111 Lab 3 Integer Variables, Mathematical Operations, & Redirection

CpSc 111 Lab 3 Integer Variables, Mathematical Operations, & Redirection CpSc 111 Lab 3 Integer Variables, Mathematical Operations, & Redirection Overview By the end of the lab, you will be able to: declare variables perform basic arithmetic operations on integer variables

More information

In Fig. 3.5 and Fig. 3.7, we include some completely blank lines in the pseudocode for readability. programs into their various phases.

In Fig. 3.5 and Fig. 3.7, we include some completely blank lines in the pseudocode for readability. programs into their various phases. Formulating Algorithms with Top-Down, Stepwise Refinement Case Study 2: Sentinel-Controlled Repetition In Fig. 3.5 and Fig. 3.7, we include some completely blank lines in the pseudocode for readability.

More information

Assignment Number 7 Lab Assignment Due Date: Wednesday, October 24, 2018 CS 1057 C Programming - Fall 2018

Assignment Number 7 Lab Assignment Due Date: Wednesday, October 24, 2018 CS 1057 C Programming - Fall 2018 Assignment Number 7 Lab Assignment Due Date: Wednesday, October 24, 2018 CS 1057 C Programming - Fall 2018 Purpose: use arrays to store useful data perform calculations using arrays confidently pass arrays

More information

CS 2316 Individual Homework 1 Python Practice Due: Wednesday, August 28th, before 11:55 PM Out of 100 points

CS 2316 Individual Homework 1 Python Practice Due: Wednesday, August 28th, before 11:55 PM Out of 100 points CS 2316 Individual Homework 1 Python Practice Due: Wednesday, August 28th, before 11:55 PM Out of 100 points Files to submit: 1. HW1.py For Help: - TA Helpdesk Schedule posted on class website. - Email

More information

CS Homework 11 p. 1. CS Homework 11

CS Homework 11 p. 1. CS Homework 11 CS 111 - Homework 11 p. 1 Deadline 11:59 pm on Monday, May 2, 2016 How to submit Each time you would like to submit your work: CS 111 - Homework 11 If your files are not already on nrs-labs, be sure to

More information

Gateway Regional School District VERTICAL ALIGNMENT OF MATHEMATICS STANDARDS Grades 3-6

Gateway Regional School District VERTICAL ALIGNMENT OF MATHEMATICS STANDARDS Grades 3-6 NUMBER SENSE & OPERATIONS 3.N.1 Exhibit an understanding of the values of the digits in the base ten number system by reading, modeling, writing, comparing, and ordering whole numbers through 9,999. Our

More information

CpSc 1111 Lab 9 2-D Arrays

CpSc 1111 Lab 9 2-D Arrays CpSc 1111 Lab 9 2-D Arrays Overview This week, you will gain some experience with 2-dimensional arrays, using loops to do the following: initialize a 2-D array with data from an input file print out the

More information

Primitive Data, Variables, and Expressions; Simple Conditional Execution

Primitive Data, Variables, and Expressions; Simple Conditional Execution Unit 2, Part 1 Primitive Data, Variables, and Expressions; Simple Conditional Execution Computer Science S-111 Harvard University David G. Sullivan, Ph.D. Overview of the Programming Process Analysis/Specification

More information

CpSc 1011 Lab 5 Conditional Statements, Loops, ASCII code, and Redirecting Input Characters and Hurricanes

CpSc 1011 Lab 5 Conditional Statements, Loops, ASCII code, and Redirecting Input Characters and Hurricanes CpSc 1011 Lab 5 Conditional Statements, Loops, ASCII code, and Redirecting Input Characters and Hurricanes Overview For this lab, you will use: one or more of the conditional statements explained below

More information

int x = 5; double y = 3; // Integer division rounds the result down to the nearest whole number. cout << "1a: " << x / 3 << endl; //1

int x = 5; double y = 3; // Integer division rounds the result down to the nearest whole number. cout << 1a:  << x / 3 << endl; //1 PART 1 - From Professor Kent Chin - div_casting.cpp /* Literals are FIXED values (e.g. 0, 5, -2, 3.14) Whole-number literals (e.g. 0, 1, -3) are integer types Literals with decimal points (e.g. 3.14, 2.718)

More information

BRANCHING if-else statements

BRANCHING if-else statements BRANCHING if-else statements Conditional Statements A conditional statement lets us choose which statement t t will be executed next Therefore they are sometimes called selection statements Conditional

More information

ENGINEERING 1020 Introduction to Computer Programming M A Y 2 6, R E Z A S H A H I D I

ENGINEERING 1020 Introduction to Computer Programming M A Y 2 6, R E Z A S H A H I D I ENGINEERING 1020 Introduction to Computer Programming M A Y 2 6, 2 0 1 0 R E Z A S H A H I D I Today s class Constants Assignment statement Parameters and calling functions Expressions Mixed precision

More information

9/10/10. Arithmetic Operators. Today. Assigning floats to ints. Arithmetic Operators & Expressions. What do you think is the output?

9/10/10. Arithmetic Operators. Today. Assigning floats to ints. Arithmetic Operators & Expressions. What do you think is the output? Arithmetic Operators Section 2.15 & 3.2 p 60-63, 81-89 1 Today Arithmetic Operators & Expressions o Computation o Precedence o Associativity o Algebra vs C++ o Exponents 2 Assigning floats to ints int

More information

Monroe County School District Elementary Pacing Guide

Monroe County School District Elementary Pacing Guide Date Taught: Second Grade Unit 1: Numbers and Operations in Base Ten Timeline: August Fall Break CMA: October 6-7 M.NO.2.1 Understand that the three digits of a three-digit number represent amounts of

More information

CS16 Exam #1 7/17/ Minutes 100 Points total

CS16 Exam #1 7/17/ Minutes 100 Points total CS16 Exam #1 7/17/2012 75 Minutes 100 Points total Name: 1. (10 pts) Write the definition of a C function that takes two integers `a` and `b` as input parameters. The function returns an integer holding

More information

Computer Science & Engineering 150A Problem Solving Using Computers

Computer Science & Engineering 150A Problem Solving Using Computers Computer Science & Engineering 150A Problem Solving Using Computers Lecture 04 - Conditionals Stephen Scott (Adapted from Christopher M. Bourke) Fall 2009 1 / 1 cbourke@cse.unl.edu Control Structure Conditions

More information

printf( Please enter another number: ); scanf( %d, &num2);

printf( Please enter another number: ); scanf( %d, &num2); CIT 593 Intro to Computer Systems Lecture #13 (11/1/12) Now that we've looked at how an assembly language program runs on a computer, we're ready to move up a level and start working with more powerful

More information

1. What is the minimum number of bits needed to store a single piece of data representing: a. An integer between 0 and 100?

1. What is the minimum number of bits needed to store a single piece of data representing: a. An integer between 0 and 100? 1 CS 105 Review Questions Most of these questions appeared on past exams. 1. What is the minimum number of bits needed to store a single piece of data representing: a. An integer between 0 and 100? b.

More information

CS159. Nathan Sprague. November 9, 2015

CS159. Nathan Sprague. November 9, 2015 CS159 Nathan Sprague November 9, 2015 Recursive Definitions Merriam Websters definition of Ancestor: Ancestor One from whom a person is descended [...] Here is a recursive version: Ancestor One s parent.

More information

Counting and Cardinality (CC) K 2 Know number names and the count sequence.

Counting and Cardinality (CC) K 2 Know number names and the count sequence. Counting and Cardinality (CC) K 2 Know number names and the count sequence. K.1 Count to 100 by ones and by tens. Essence: Counting E1: Count up to 50 by 1s or 10s. E2: Count up to 20 by 1s. E3: Using

More information

UNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING

UNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING UNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING CMPE13/L: INTRODUCTION TO PROGRAMMING IN C SPRING 2012 Lab 3 Matrix Math Introduction Reading In this lab you will write a

More information

Dublin Unified School District Suggested Pacing Guide for Grade 2 Text: Scott Foresman-Addison Wesley envision Math

Dublin Unified School District Suggested Pacing Guide for Grade 2 Text: Scott Foresman-Addison Wesley envision Math Trimester 1 8 Topic 1: Understanding Addition and Subtraction 1 1-1: s: Writing Addition Sentences, 1 1-2: s: Stories About Joining AF 1.0,, 1 1-3: s: Writing Subtraction Sentences, 1 1-4: s: Stories About

More information

CpSc 1111 Lab 4 Part a Flow Control, Branching, and Formatting

CpSc 1111 Lab 4 Part a Flow Control, Branching, and Formatting CpSc 1111 Lab 4 Part a Flow Control, Branching, and Formatting Your factors.c and multtable.c files are due by Wednesday, 11:59 pm, to be submitted on the SoC handin page at http://handin.cs.clemson.edu.

More information

Chapter 7 Arithmetic

Chapter 7 Arithmetic Chapter 7 Arithmetic 7-1 Arithmetic in C++ Arithmetic expressions are made up of constants, variables, operators and parentheses. The arithmetic operators in C++ are as follows + (addition) - (subtraction)

More information

Lab 6B Coin Collection

Lab 6B Coin Collection HNHS Computer Programming I / IPFW CS 11400 Bower - Page 1 Lab 6B Coin Collection You will create a program that allows users to enter the quantities of an assortment of coins (quarters, dimes, nickels,

More information

CS 112: Intro to Comp Prog

CS 112: Intro to Comp Prog CS 112: Intro to Comp Prog Lecture Review Data Types String Operations Arithmetic Operators Variables In-Class Exercises Lab Assignment #2 Upcoming Lecture Topics Variables * Types Functions Purpose Parameters

More information

CpSc 111 Lab 5 Conditional Statements, Loops, the Math Library, and Redirecting Input

CpSc 111 Lab 5 Conditional Statements, Loops, the Math Library, and Redirecting Input CpSc Lab 5 Conditional Statements, Loops, the Math Library, and Redirecting Input Overview For this lab, you will use: one or more of the conditional statements explained below scanf() or fscanf() to read

More information

Topics. Chapter 5. Equality Operators

Topics. Chapter 5. Equality Operators Topics Chapter 5 Flow of Control Part 1: Selection Forming Conditions if/ Statements Comparing Floating-Point Numbers Comparing Objects The equals Method String Comparison Methods The Conditional Operator

More information

Slide 1 CS 170 Java Programming 1 Real Numbers Duration: 00:00:54 Advance mode: Auto

Slide 1 CS 170 Java Programming 1 Real Numbers Duration: 00:00:54 Advance mode: Auto CS 170 Java Programming 1 Real Numbers Understanding Java's Floating Point Primitive Types Slide 1 CS 170 Java Programming 1 Real Numbers Duration: 00:00:54 Floating-point types Can hold a fractional amount

More information

Slide 1 CS 170 Java Programming 1 The Switch Duration: 00:00:46 Advance mode: Auto

Slide 1 CS 170 Java Programming 1 The Switch Duration: 00:00:46 Advance mode: Auto CS 170 Java Programming 1 The Switch Slide 1 CS 170 Java Programming 1 The Switch Duration: 00:00:46 Menu-Style Code With ladder-style if-else else-if, you might sometimes find yourself writing menu-style

More information

CSE 1001 Fundamentals of Software Development 1. Identifiers, Variables, and Data Types Dr. H. Crawford Fall 2018

CSE 1001 Fundamentals of Software Development 1. Identifiers, Variables, and Data Types Dr. H. Crawford Fall 2018 CSE 1001 Fundamentals of Software Development 1 Identifiers, Variables, and Data Types Dr. H. Crawford Fall 2018 Identifiers, Variables and Data Types Reserved Words Identifiers in C Variables and Values

More information

Expressions. Arithmetic expressions. Logical expressions. Assignment expression. n Variables and constants linked with operators

Expressions. Arithmetic expressions. Logical expressions. Assignment expression. n Variables and constants linked with operators Expressions 1 Expressions n Variables and constants linked with operators Arithmetic expressions n Uses arithmetic operators n Can evaluate to any value Logical expressions n Uses relational and logical

More information

Physics 2660: Fundamentals of Scientific Computing. Lecture 5 Instructor: Prof. Chris Neu

Physics 2660: Fundamentals of Scientific Computing. Lecture 5 Instructor: Prof. Chris Neu Physics 2660: Fundamentals of Scientific Computing Lecture 5 Instructor: Prof. Chris Neu (chris.neu@virginia.edu) Reminder I am back! HW04 due Thursday 22 Feb electronically by noon HW grades are coming.

More information

Simpson Elementary School Curriculum Prioritization and Mapping 2nd Grade Math - Revised 6/2014

Simpson Elementary School Curriculum Prioritization and Mapping 2nd Grade Math - Revised 6/2014 Simpson lementary School Curriculum Prioritization and Mapping Timeline Topic Priority Standard Learning Targets On-Going 2.OA.2 - Fluently add and subtract within 20 using mental strategies by end of

More information

SELECTION IDIOMS. Here is a summary of appropriate selection idioms: Selection Idioms. Action Condition Construct to Use. Sequential if statements

SELECTION IDIOMS. Here is a summary of appropriate selection idioms: Selection Idioms. Action Condition Construct to Use. Sequential if statements SELECTION IDIOMS The programming idioms for selection statements depend on the concept of mutual exclusion. Two truth values are mutually exclusive if no more than one of them can be true. Two actions

More information

Math 7 Notes Unit Three: Applying Rational Numbers

Math 7 Notes Unit Three: Applying Rational Numbers Math 7 Notes Unit Three: Applying Rational Numbers Strategy note to teachers: Typically students need more practice doing computations with fractions. You may want to consider teaching the sections on

More information

Lab 2: Structured Program Development in C

Lab 2: Structured Program Development in C Lab 2: Structured Program Development in C (Part A: Your first C programs - integers, arithmetic, decision making, Part B: basic problem-solving techniques, formulating algorithms) Learning Objectives

More information

PA3: Violet's Vending Venture (Version 3.0)

PA3: Violet's Vending Venture (Version 3.0) CS 159: Programming Fundamentals James Madison University, Spring 2017 Semester PA3: Violet's Vending Venture (Version 3.0) Due Dates PA3-A: Wednesday, Feb. 22 at 11:00 pm PA3-A is a Canvas online readiness

More information

C++ Style Guide. 1.0 General. 2.0 Visual Layout. 3.0 Indentation and Whitespace

C++ Style Guide. 1.0 General. 2.0 Visual Layout. 3.0 Indentation and Whitespace C++ Style Guide 1.0 General The purpose of the style guide is not to restrict your programming, but rather to establish a consistent format for your programs. This will help you debug and maintain your

More information

Full file at

Full file at Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class

More information

Fundamentals of Programming Session 7

Fundamentals of Programming Session 7 Fundamentals of Programming Session 7 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2014 These slides have been created using Deitel s slides Sharif University of Technology Outlines

More information

Chapter 2. Section 2.3 if and if-else statements. CS 50 Hathairat Rattanasook

Chapter 2. Section 2.3 if and if-else statements. CS 50 Hathairat Rattanasook Chapter 2 Section 2.3 if and if-else statements CS 50 Hathairat Rattanasook if Statement An if-statement is a statement with a condition that can be evaluated to true or false. If it evaluates to true,

More information

CS 221 Lecture. Tuesday, 13 September 2011

CS 221 Lecture. Tuesday, 13 September 2011 CS 221 Lecture Tuesday, 13 September 2011 Today s Agenda 1. Announcements 2. Boolean Expressions and logic 3. MATLAB Fundamentals 1. Announcements First in-class quiz: Tuesday 4 October Lab quiz: Thursday

More information

CS 206 Introduction to Computer Science II

CS 206 Introduction to Computer Science II CS 206 Introduction to Computer Science II 03 / 25 / 2013 Instructor: Michael Eckmann Today s Topics Comments/Questions? More on Recursion Including Dynamic Programming technique Divide and Conquer techniques

More information

Introduction to Computer Systems

Introduction to Computer Systems Introduction to Computer Systems Syllabus Web Page http://www.cs.northwestern.edu/~pdinda/icsclass Instructor Peter A. Dinda 1890 Maple Avenue, Room 338 847-467-7859 pdinda@cs.northwestern.edu Office hours:

More information

CpSc 1111 Lab 6 Conditional Statements, Loops, the Math Library, and Random Numbers What s the Point?

CpSc 1111 Lab 6 Conditional Statements, Loops, the Math Library, and Random Numbers What s the Point? CpSc 1111 Lab 6 Conditional Statements, Loops, the Math Library, and Random Numbers What s the Point? Overview For this lab, you will use: one or more of the conditional statements explained below scanf()

More information

CS 135 Lab Assignments Week 1

CS 135 Lab Assignments Week 1 CS 135 Lab Assignments Week 1 Professor: Matt B. Pedersen This handout is the assignment that you must finish for the lab portion of the course in week 1. You must finish the assignments yourself; if you

More information

Use of scanf. scanf("%d", &number);

Use of scanf. scanf(%d, &number); Use of scanf We have now discussed how to print out formatted information to the screen, but this isn't nearly as useful unless we can read in information from the user. (This is one way we can make a

More information

Code Created In Class To Help With Lab 6 October 8, 2018 CIS 1057 Fall 2018

Code Created In Class To Help With Lab 6 October 8, 2018 CIS 1057 Fall 2018 Key Takeaways from Class: Code Created In Class To Help With Lab 6 October 8, 2018 CIS 1057 Fall 2018 1. Always write programs in steps, not all at once. 2. Have a plan before you start writing code. 3.

More information

CSE 303 Lecture 8. Intro to C programming

CSE 303 Lecture 8. Intro to C programming CSE 303 Lecture 8 Intro to C programming read C Reference Manual pp. Ch. 1, 2.2-2.4, 2.6, 3.1, 5.1, 7.1-7.2, 7.5.1-7.5.4, 7.6-7.9, Ch. 8; Programming in C Ch. 1-6 slides created by Marty Stepp http://www.cs.washington.edu/303/

More information

MATH STUDENT BOOK. 6th Grade Unit 3

MATH STUDENT BOOK. 6th Grade Unit 3 MATH STUDENT BOOK 6th Grade Unit 3 Unit 3 Decimals MATH 603 Decimals INTRODUCTION 3 1. DECIMAL NUMBERS 5 DECIMALS AND PLACE VALUE 6 ORDERING AND COMPARING 12 ROUNDING AND ESTIMATING 16 ADDING AND SUBTRACTING

More information

CSCI Wednesdays: 1:25-2:15 Keller Thursdays: 4:00-4:50 Akerman 211

CSCI Wednesdays: 1:25-2:15 Keller Thursdays: 4:00-4:50 Akerman 211 C++ Basics CSCI 1113 Wednesdays: 1:25-2:15 Keller 1-250 Thursdays: 4:00-4:50 Akerman 211 Peer-assisted Learning sessions - PAL Weekly practice with course concepts Work with peers to reinforce understanding

More information

Chapter 4: Control Structures I (Selection) Objectives. Objectives (cont d.) Control Structures. Control Structures (cont d.

Chapter 4: Control Structures I (Selection) Objectives. Objectives (cont d.) Control Structures. Control Structures (cont d. Chapter 4: Control Structures I (Selection) In this chapter, you will: Objectives Learn about control structures Examine relational and logical operators Explore how to form and evaluate logical (Boolean)

More information

Casey County Schools- 2 nd Grade Math Curriculum Map

Casey County Schools- 2 nd Grade Math Curriculum Map Week(s) Concept (Big Ideas) Weeks 1 Topic 1 Understanding Addition and Subtraction Standards I can statement Critical Vocabulary 2.OA.1 Use addition and subtraction within 100 to solve oneand two-step

More information

Mississippi College and Career Readiness Standards for Mathematics Scaffolding Document. Grade 2

Mississippi College and Career Readiness Standards for Mathematics Scaffolding Document. Grade 2 Mississippi College and Career Readiness Standards for Mathematics Scaffolding Document Grade 2 Operations and Algebraic Thinking Represent and solve problems involving addition and subtraction 2.OA.1

More information

Midterm No. 2 for V XXX Sample for Practice Only

Midterm No. 2 for V XXX Sample for Practice Only Midterm No. 2 for V22.0002.XXX Sample for Practice Only Warning: This is a long practice test. I will make an effort to keep the problems short enough to finish within the time limit of the real test.

More information

CSCI 136 Data Structures & Advanced Programming. Spring 2018 Instructors Bill Jannen & Jon Park

CSCI 136 Data Structures & Advanced Programming. Spring 2018 Instructors Bill Jannen & Jon Park CSCI 136 Data Structures & Advanced Programming Spring 2018 Instructors Bill Jannen & Jon Park Today s Outline Course Preview Course Bureaucracy Crash Course in Java Part 1 2 Why Take CS136? To learn about:

More information

CpSc 1111 Lab 4 Formatting and Flow Control

CpSc 1111 Lab 4 Formatting and Flow Control CpSc 1111 Lab 4 Formatting and Flow Control Overview By the end of the lab, you will be able to: use fscanf() to accept a character input from the user and print out the ASCII decimal, octal, and hexadecimal

More information

CS Homework 10 p. 1. CS Homework 10

CS Homework 10 p. 1. CS Homework 10 CS 111 - Homework 10 p. 1 Deadline 11:59 pm on Friday, December 2, 2016 How to submit Each time you would like to submit your work: CS 111 - Homework 10 If your files are not already on nrs-labs, be sure

More information

Chapter 2. Designing a Program. Input, Processing, and Output Fall 2016, CSUS. Chapter 2.1

Chapter 2. Designing a Program. Input, Processing, and Output Fall 2016, CSUS. Chapter 2.1 Chapter 2 Input, Processing, and Output Fall 2016, CSUS Designing a Program Chapter 2.1 1 Algorithms They are the logic on how to do something how to compute the value of Pi how to delete a file how to

More information

Lesson 5: Introduction to the Java Basics: Java Arithmetic THEORY. Arithmetic Operators

Lesson 5: Introduction to the Java Basics: Java Arithmetic THEORY. Arithmetic Operators Lesson 5: Introduction to the Java Basics: Java Arithmetic THEORY Arithmetic Operators There are four basic arithmetic operations: OPERATOR USE DESCRIPTION + op1 + op2 Adds op1 and op2 - op1 + op2 Subtracts

More information

Selections. CSE 114, Computer Science 1 Stony Brook University

Selections. CSE 114, Computer Science 1 Stony Brook University Selections CSE 114, Computer Science 1 Stony Brook University http://www.cs.stonybrook.edu/~cse114 1 Motivation If you assigned a negative value for radius in ComputeArea.java, then you don't want the

More information

bool bool - either true or false

bool bool - either true or false Strings & Branching bool bool - either true or false You have the common math comparisons: > (greater than), e.g. 7 > 2.5 is true == (equals), e.g. 5 == 4 is false

More information

Lab 1 Introduction to UNIX and C

Lab 1 Introduction to UNIX and C Name: Lab 1 Introduction to UNIX and C This first lab is meant to be an introduction to computer environments we will be using this term. You must have a Pitt username to complete this lab. NOTE: Text

More information

Note: unless otherwise stated, the questions are with reference to the C Programming Language. You may use extra sheets if need be.

Note: unless otherwise stated, the questions are with reference to the C Programming Language. You may use extra sheets if need be. CS 156 : COMPUTER SYSTEM CONCEPTS TEST 1 (C PROGRAMMING PART) FEBRUARY 6, 2001 Student s Name: MAXIMUM MARK: 100 Time allowed: 45 minutes Note: unless otherwise stated, the questions are with reference

More information

SECOND GRADE Mathematic Standards for the Archdiocese of Detroit

SECOND GRADE Mathematic Standards for the Archdiocese of Detroit SECOND GRADE Mathematic Standards for the Archdiocese of Detroit Operations and Algebraic Thinking Represent and solve problems involving addition and subtraction. 2.OA. A. 1 Use addition and subtraction

More information

Add and subtract within 20.

Add and subtract within 20. Represent and solve problems involving addition and subtraction. 2.OA.1. Use addition and subtraction within 100 to solve one- and twostep word problems involving situations of adding to, taking from,

More information

HOW TO DIVIDE: MCC6.NS.2 Fluently divide multi-digit numbers using the standard algorithm. WORD DEFINITION IN YOUR WORDS EXAMPLE

HOW TO DIVIDE: MCC6.NS.2 Fluently divide multi-digit numbers using the standard algorithm. WORD DEFINITION IN YOUR WORDS EXAMPLE MCC6.NS. Fluently divide multi-digit numbers using the standard algorithm. WORD DEFINITION IN YOUR WORDS EXAMPLE Dividend A number that is divided by another number. Divisor A number by which another number

More information

CSE101-lec#12. Designing Structured Programs Introduction to Functions. Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU

CSE101-lec#12. Designing Structured Programs Introduction to Functions. Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU CSE101-lec#12 Designing Structured Programs Introduction to Functions Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU Outline Designing structured programs in C: Counter-controlled repetition

More information

3rd Grade Mathematics

3rd Grade Mathematics 3rd Grade Mathematics 2012-2013 MONTH CONTENT/ THEME CORE GOALS/SKILLS WRITTEN ASSESSMENT TEN MINUTE MATH VOCABULARY September 17 days Trading Stickers, Combining Coins Unit 1 *NOT CC NUMBERS AND Addition,

More information

Note: If only one statement is to be followed by the if or else condition then there is no need of parenthesis.

Note: If only one statement is to be followed by the if or else condition then there is no need of parenthesis. Birla Institute of Technology & Science, Pilani Computer Programming (CSF111) Lab-4 ---------------------------------------------------------------------------------------------------------------------------------

More information

} Evaluate the following expressions: 1. int x = 5 / 2 + 2; 2. int x = / 2; 3. int x = 5 / ; 4. double x = 5 / 2.

} Evaluate the following expressions: 1. int x = 5 / 2 + 2; 2. int x = / 2; 3. int x = 5 / ; 4. double x = 5 / 2. Class #10: Understanding Primitives and Assignments Software Design I (CS 120): M. Allen, 19 Sep. 18 Java Arithmetic } Evaluate the following expressions: 1. int x = 5 / 2 + 2; 2. int x = 2 + 5 / 2; 3.

More information

Reviewing all Topics this term

Reviewing all Topics this term Today in CS161 Prepare for the Final Reviewing all Topics this term Variables If Statements Loops (do while, while, for) Functions (pass by value, pass by reference) Arrays (specifically arrays of characters)

More information

if Statement Numeric Rela5onal Operators The if Statement Flow of Control: Branching (Savitch, Chapter 3)

if Statement Numeric Rela5onal Operators The if Statement Flow of Control: Branching (Savitch, Chapter 3) if Statement Flow of Control: Branching (Savitch, Chapter 3) TOPICS Conditional Execution if and Statement Boolean Data switch Statement Ensures that a statement is executed only when some condi5on is

More information

in normal arithmetic = == = == 5 7 x 2 = 24 7 * 2 == = 3 remainder 1 7 / 2 7 % 2

in normal arithmetic = == = == 5 7 x 2 = 24 7 * 2 == = 3 remainder 1 7 / 2 7 % 2 2 Arithmetic 2.1 The Natural Numbers We have all used natural counting numbers such as 1, 2 and 3 in simple arithmetic calculations. In C, the natural counting numbers between 0 and 65535 inclusive are

More information

EECE.2160: ECE Application Programming Spring 2016 Exam 1 Solution

EECE.2160: ECE Application Programming Spring 2016 Exam 1 Solution EECE.2160: ECE Application Programming Spring 2016 Exam 1 Solution 1. (20 points, 5 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling

More information

if Statement Numeric Rela7onal Operators The if Statement Flow of Control: Branching (Savitch, Chapter 3)

if Statement Numeric Rela7onal Operators The if Statement Flow of Control: Branching (Savitch, Chapter 3) if Statement Flow of Control: Branching (Savitch, Chapter 3) TOPICS Conditional Execution if,, and if boolean data switch statements CS 160, Fall Semester 2015 1 Programs o-en contain statements that may

More information

Macon County

Macon County 2 nd Grade Math Timeline Macon County 2014-2015 1 st 9 Weeks a number problem. (i.e. number talk) 2.NBT.A.1.b I can explain the value of each digit in a 3 digit number (R ) * 2.NBT.A.1.a I can recognize

More information

There are algorithms, however, that need to execute statements in some other kind of ordering depending on certain conditions.

There are algorithms, however, that need to execute statements in some other kind of ordering depending on certain conditions. Introduction In the programs that we have dealt with so far, all statements inside the main function were executed in sequence as they appeared, one after the other. This type of sequencing is adequate

More information

Physics 2660: Fundamentals of Scientific Computing. Lecture 7 Instructor: Prof. Chris Neu

Physics 2660: Fundamentals of Scientific Computing. Lecture 7 Instructor: Prof. Chris Neu Physics 2660: Fundamentals of Scientific Computing Lecture 7 Instructor: Prof. Chris Neu (chris.neu@virginia.edu) Reminder HW06 due Thursday 15 March electronically by noon HW grades are starting to appear!

More information

CSCD 255 HW 2. No string (char arrays) or any other kinds of array variables are allowed

CSCD 255 HW 2. No string (char arrays) or any other kinds of array variables are allowed CSCD 255 HW 2 Design a program called cscd255hw2.c which reads in a strictly positive integer (1 or greater) from the user. The user will then be prompted with a menu of choices (this menu should be repetitively

More information

TY1 / TY+ Guide. On/ Off $ Menu Enter. PIN # - The PIN number is needed for calibrations and programming.

TY1 / TY+ Guide. On/ Off $ Menu Enter. PIN # - The PIN number is needed for calibrations and programming. TY1 / TY+ Guide PIN # - The PIN number is needed for calibrations and programming. On/ Off $ Menu Enter 1 First press and release the on.off button (one star on the screen). 2 Then press and release the

More information

Grade 2 Mathematics Curriculum Map

Grade 2 Mathematics Curriculum Map 1 st Unit 1A: Underst Place Value *2.NBT.2 is repeated in Units 2 3, each time extending the skill. The skill focused on in this unit is bolded in the S.L.O. 2.NBT.1 Underst that the 3 digits of a 3-digit

More information

Welcome to... CS113: Introduction to C

Welcome to... CS113: Introduction to C Welcome to... CS113: Introduction to C Instructor: Erik Sherwood E-mail: wes28@cs.cornell.edu Course Website: http://www.cs.cornell.edu/courses/cs113/2005fa/ The website is linked to from the courses page

More information

1/12/2012. Jim Williams HONP-112 Week 3

1/12/2012. Jim Williams HONP-112 Week 3 Jim Williams HONP-112 Week 3 Set Theory is a practical implementation of Boolean logic that examines the relationships between groups of objects. Set theory has numerous real-life applications in computer

More information

CSCI 136 Data Structures & Advanced Programming. Fall 2018 Instructors Bill Lenhart & Bill Jannen

CSCI 136 Data Structures & Advanced Programming. Fall 2018 Instructors Bill Lenhart & Bill Jannen CSCI 136 Data Structures & Advanced Programming Fall 2018 Instructors Bill Lenhart & Bill Jannen Administrative Details Class roster: Who s here? And who s trying to get in? Handout: Class syllabus Lecture

More information

Chapter 6. Decision and Control Statements

Chapter 6. Decision and Control Statements Chapter 6. Decision and Control Statements Once a decision was made, I did not worry about it afterward. Harry Truman Calculations and expressions are only a small part of computer programming. Decision

More information

CprE 281: Digital Logic

CprE 281: Digital Logic CprE 281: Digital Logic Instructor: Alexander Stoytchev http://www.ece.iastate.edu/~alexs/classes/ Floating Point Numbers CprE 281: Digital Logic Iowa State University, Ames, IA Copyright Alexander Stoytchev

More information

Two Types of Types. Primitive Types in Java. Using Primitive Variables. Class #07: Java Primitives. Integer types.

Two Types of Types. Primitive Types in Java. Using Primitive Variables. Class #07: Java Primitives. Integer types. Class #07: Java Primitives Software Design I (CS 120): M. Allen, 13 Sep. 2018 Two Types of Types So far, we have mainly been dealing with objects, like DrawingGizmo, Window, Triangle, that are: 1. Specified

More information

2nd Grade Iowa Core - I Cans...

2nd Grade Iowa Core - I Cans... Operations and Algebraic Thinking 2.OA Operations and Algebraic Thinking 2.OA Represent and solve problems involving addition Represent and solve problems involving addition and subtraction. and subtraction.

More information

Variables, Data Types, and Arithmetic Expressions Learning Objectives:

Variables, Data Types, and Arithmetic Expressions Learning Objectives: Variables, Data Types, and Arithmetic Expressions Learning Objectives: Printing more than one variable in one printf() Printing formatting characters in printf Declaring and initializing variables A couple

More information

http://xkcd.com/224/ CS 152: Programming Language Paradigms Prof. Tom Austin San José State University What are some programming languages? Taken from http://pypl.github.io/pypl.html January 2016 Why are

More information

DLM Mathematics Year-End Assessment Model Blueprint

DLM Mathematics Year-End Assessment Model Blueprint DLM Mathematics Year-End Assessment Model 2017-18 Blueprint In this document, the blueprint refers to the range of Essential Elements (s) that will be assessed during the spring 2018 assessment window.

More information