Java Programming. Computer Science 112
|
|
- Geraldine Blair
- 5 years ago
- Views:
Transcription
1 Java Programming Computer Science 112
2 Yay Programming! How did the RPS program go? Did you notice the part where I pointed at the answer on the board that we did together? Biggest problems in NumbersAndMath Incorrect math 60*60*24*365 Missing directions Fortnights - I will always give you the answer, because there is no interpreting, unlike English Zip the src folder. C'mon. Matters in real life; automated grading Have I mentioned the Fiver Plan?
3 The Fiver Plan Sometimes you just can't get to a homework Family thing Work thing Hangover thing But the cumulative nature of learning programming means that you can prove retroactively that you do actually know the material. So if you ever get a 10 on a program, all past zeroes that are encompassed by that program become 5's.
4 Recap: If The diamond symbol in the flow charts is an "if" statement. A decision to be made. Convert the English version written out in to an "if clause" using && for and for or () for parentheses to control the order it resolves.
5 Example - Snooze Alarm again Start Clock waits for right time Alarm Rings Hit snooze button Get up yet? No Yes Get up Get ready for work End
6 It's a diamond, so it's an if... right? If one of the branches goes back up, it makes a loop. Same exact process to convert the decision in to code though. Still a "decision clause" "While I'm not ready to get up, hit snooze and wait for the alarm" while(!treadytogetup ) } // Hit snooze // Wait // Alarm rings // Check sleepiness level
7 Yay while loops! While I'm not at the door, take a step While I am not full, eat some pie While I owe you money, run while( tmoneyiowe > 0 ) // Run away }
8 When does while end? while( something true right now ) // I run forever. So something in here // better be connected to that while-clause } Otherwise this is an INFINITE LOOP, and it is BAD.
9 Infinite loops are what? They are BAD See previous slide.
10 How to prevent infinite loops? while( tmoneyiowe > 0 ) // Run away } Running away will never change the money owed, so this loop will run forever.
11 How to prevent infinite loops. while( tmoneyiowe > 0 ) // Pay a dollar instead } tmoneyiowe is going to go down now, so we'll finish eventually.
12 Examples while( tmoneyiowe > 0 ) thismoney = thismoney + 1; tmoneyiowe = tmoneyiowe - 1; } int tlinesprinted = 0; while( tlinesprinted < 5 ) System.out.println("I like pie."); tlinesprinted++; // This ++ is a shortcut for "add 1 to this". }
13 do-while Neat subtle variation "while" checks first and then does stuff "do-while" does stuff and then checks do // Give him a dollar } while (tmoneyiowe > 0); // Wrong pick if I owe 0. While makes more sense do // Print something to screen } while ( tlinesprinted < tlinesiwant ); // I know I want to print at least one
14 Grab that old worksheet Paper assignments are pretty much always going to be for things like this. Let's take those loop flowcharts and make them in to code. Roll the screen up now, me.
15 for I knoweth the number of the loop A while loop is used when stuff is going to happen and you don't know when it will end Terminating might depend on user input Might depend on an outside timer If you know exactly how many times you want to do something, that is a "for loop" It has the worst syntax ev-ar Write this next bit down I'm sorry
16 An idiom for for-loops for( int i = 0; i < tcount; i++ ) } Part three will connect to part two to prevent infinite loops in the same way as a while for( thing to do once at the start; same as a while clause - "while this is true"; what to do after the end of each loop)
17 Please don't just always do that Nothing magical about examples or idioms This slide added for that one kid last year who thought for loops had to have "i" in them for( int tpeoplecounted = 0; tpeoplecounted < 5; tpeoplecounted++ ) If initial thing is complicated, it can be outside int tpieslices = sum total of all pie eaten by all students last year; // maybe other stuff happens too for( ; tpieslices >= 0; tpieslices-- ) // Oooh, the first part is blank.
18 That one bug Eclipse keeps causing Don't put a semicolon after a while or for or if! Eclipse is just too excited to help....but you do after a do. if( tmonkeys > 5 ); //BAD for( int i = 0; i < 10; i++ ); // BAD } while( tpie >= 0 ); // BAD } do } while ( tpants == true ); // good
19 Advanced magic You have for loops and while loops and feel all powerful Take a moment to feel powerful Two advanced commands when working with loops continue = "Start the next loop right now." break = "Finish this whole loop right now." If a while loop is horribly complicated and has four ways to end you can rely on "break" as a way out
20 break and continue // Manage a list of extortion victims for( int i = 0; i < tcount; i++ ) if( this guy is broke ) continue; // No need to process this guy take his money; if( I have enough money ) break; // No need to process anyone else }
21 The console menu program "Show a menu and do stuff until they want to quit" do // Show Menu (Pick 1 or 2, or 3 to quit) // If choice 1 do stuff // If choice 2 do stuff } while ( they don't pick 3 ); Like in all programming, there are many ways to do this.
22 Double loopatron Show Menu Try again 1, 2, or 3? N Y 1 Do 1's stuff Y 2 Do 2's stuff Say goodbye I am worth copying down. I may come up later. Taking notes is fun!
23 Except "show menu" is tricky Two ways the user can mess up Enter a number that isn't a choice Enter something that isn't a number True of all user input so I'll say them again Valid but incorrect Invalid Tooootally on the test
24 Valid but incorrect Enter R P or S I enter H Enter your salary I enter -70 You followed instructions, but your input didn't make sense
25 Invalid Enter R P or S I enter 76 Enter your salary I enter "Idaho" I was expecting a certain type of input and you tried to break me.
26 Parse Yon Input I have explained the perils of nextint for getting numbers from the user. I consider Scanner nerd-functional. It technically works, but it doesn't account for how actual people use things I am going to recommend always using nextline, and then checking to see if it is a number. Law of "If it works it works" is equal to law of "If it crashes you lose points" though, so you can risk following your heart.
27 Parlez-vous Integer? String tliteralpick = tkeyboard.nextline(); int tintegerpick = Integer.parseInt(tLiteralPick); But if they enter "H", parseint will fail! Crashing is the worst thing ever. Never. Crash. "try" to parse the String or you get
28 Try-throw-catch "Please "try" to do this. If you fail, "throw" me an exception and I'll "catch" it. try } tintegerpick = Integer.parseInt(tLiteralPick); catch( NumberFormatException e )// The type is from last slide } System.out.println("That isn't even a number"); tintegerpick = -1;
29 try program }? Yay! I'll never crash? You'll just end suddenly and abruptly Doesn't count as fixed Always have your try around as few lines as possible In a complicated program you don't want to end up inside ten of them at the same time Never be happy about hitting it It should NOT be used like an if. Never intentionally hit it. It is used to guard against failings in code you can't control, like parseint. Detailed details are way later in semester.
30 Handholding time Make a program with a menu It needs some good choices and a quit choice. This program, make all choices numbers. For each choice, just print a string. Don't care what. If you change around the basic double loopatron, that is okay. But you must use as few lines as possible. No crazy triple Polish notation.
31 We have to go deeper One of your choices is now a menu itself. Ha ha. If you have been neat and organized, this is seriously a copypaste. Ctrl+A Ctrl+I are your friend. It fixes your ugly for you. Platform/Compiler dependant. Looking for "reformat" or "indent" command. It straightens out all the lines correctly. You can work on homework or go home. Please stop not turning anything in. I give 6 points for even trying.
Java Programming. Computer Science 112 Class 2
Java Programming Computer Science 112 Class 2 The first assignment It is extra credit (5/0) Mostly a test of your determination. I gave points for trying. println(" * * *"); // etc print(" * "); print(number);
More informationMITOCW watch?v=0jljzrnhwoi
MITOCW watch?v=0jljzrnhwoi The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To
More informationJava Programming. Computer Science 112
Java Programming Computer Science 112 Review: Problem solving Class 4 is the Whole Point of Programming. You can keep the papers; we gonna go through them on the board. If you are desperately confused
More informationJava Programming. Computer Science 112
Java Programming Computer Science 112 Review: Problem solving Class 4 is the Whole Point of Programming. Is there any particular one you'd like to go through? If you are desperately confused still, now
More informationCONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction
CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics COMP-202 Unit 1: Introduction Announcements Did you miss the first lecture? Come talk to me after class. If you want
More informationPROFESSOR: Well, yesterday we learned a bit about symbolic manipulation, and we wrote a rather stylized
MITOCW Lecture 4A PROFESSOR: Well, yesterday we learned a bit about symbolic manipulation, and we wrote a rather stylized program to implement a pile of calculus rule from the calculus book. Here on the
More informationThe following content is provided under a Creative Commons license. Your support
MITOCW Lecture 10 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high-quality educational resources for free. To make a
More informationMITOCW watch?v=9h6muyzjms0
MITOCW watch?v=9h6muyzjms0 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To
More informationCS3 Fall 05 Midterm 1 Standards and Solutions
CS3 Fall 05 Midterm 1 Standards and Solutions Problem (7 points, 11 minutes). Fill in the blanks. Each of the following parts has a blank that you need to fill in. For parts (1)-(5), the blank follows
More informationMost of the class will focus on if/else statements and the logical statements ("conditionals") that are used to build them. Then I'll go over a few
With notes! 1 Most of the class will focus on if/else statements and the logical statements ("conditionals") that are used to build them. Then I'll go over a few useful functions (some built into standard
More informationHow to Improve Your Campaign Conversion Rates
How to Improve Your Email Campaign Conversion Rates Chris Williams Author of 7 Figure Business Models How to Exponentially Increase Conversion Rates I'm going to teach you my system for optimizing an email
More informationProblem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur
Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Lecture 15 Branching : IF ELSE Statement We are looking
More informationSkill 1: Multiplying Polynomials
CS103 Spring 2018 Mathematical Prerequisites Although CS103 is primarily a math class, this course does not require any higher math as a prerequisite. The most advanced level of mathematics you'll need
More informationMITOCW ocw f99-lec07_300k
MITOCW ocw-18.06-f99-lec07_300k OK, here's linear algebra lecture seven. I've been talking about vector spaces and specially the null space of a matrix and the column space of a matrix. What's in those
More informationMITOCW watch?v=se4p7ivcune
MITOCW watch?v=se4p7ivcune The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To
More informationCSE 142/143 Unofficial Commenting Guide Eric Arendt, Alyssa Harding, Melissa Winstanley
CSE 142/143 Unofficial Commenting Guide Eric Arendt, Alyssa Harding, Melissa Winstanley In Brief: What You Need to Know to Comment Methods in CSE 143 Audience o A random person you don t know who wants
More informationOut for Shopping-Understanding Linear Data Structures English
Out for Shopping-Understanding Linear Data Structures English [MUSIC PLAYING] [MUSIC PLAYING] TANZEELA ALI: Hi, it's Tanzeela Ali. I'm a software engineer, and also a teacher at Superior University, which
More informationTroubleshooting Maple Worksheets: Common Problems
Troubleshooting Maple Worksheets: Common Problems So you've seen plenty of worksheets that work just fine, but that doesn't always help you much when your worksheet isn't doing what you want it to. This
More information(Refer Slide Time: 01:25)
Computer Architecture Prof. Anshul Kumar Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture - 32 Memory Hierarchy: Virtual Memory (contd.) We have discussed virtual
More information"Missing log" in edit viewer, all media gone Posted by prodeuser - 17 Aug :14
"Missing log" in edit viewer, all media gone Posted by prodeuser - 17 Aug 2013 06:14 So, this has happened a couple of times now. I am a new Lightworks user and have been doing some testing. As I increase
More informationJava Programming Constructs Java Programming 2 Lesson 1
Java Programming Constructs Java Programming 2 Lesson 1 Course Objectives Welcome to OST's Java 2 course! In this course, you'll learn more in-depth concepts and syntax of the Java Programming language.
More informationBoolean Expressions. Is Equal and Is Not Equal
3 MAKING CHOICES Now that we ve covered how to create constants and variables, you re ready to learn how to tell your computer to make choices. This chapter is about controlling the flow of a computer
More informationBoolean Expressions. Is Equal and Is Not Equal
3 MAKING CHOICES ow that we ve covered how to create constants and variables, you re ready to learn how to tell your computer to make choices. This chapter is about controlling the flow of a computer program
More informationThe following content is provided under a Creative Commons license. Your support
MITOCW Recitation 1 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high-quality educational resources for free. To make
More informationFormal Methods of Software Design, Eric Hehner, segment 1 page 1 out of 5
Formal Methods of Software Design, Eric Hehner, segment 1 page 1 out of 5 [talking head] Formal Methods of Software Engineering means the use of mathematics as an aid to writing programs. Before we can
More informationLesson 3 Transcript: Part 1 of 2 - Tools & Scripting
Lesson 3 Transcript: Part 1 of 2 - Tools & Scripting Slide 1: Cover Welcome to lesson 3 of the db2 on Campus lecture series. Today we're going to talk about tools and scripting, and this is part 1 of 2
More informationThe name of our class will be Yo. Type that in where it says Class Name. Don t hit the OK button yet.
Mr G s Java Jive #2: Yo! Our First Program With this handout you ll write your first program, which we ll call Yo. Programs, Classes, and Objects, Oh My! People regularly refer to Java as a language that
More informationCOP 3330 Final Exam Review
COP 3330 Final Exam Review I. The Basics (Chapters 2, 5, 6) a. comments b. identifiers, reserved words c. white space d. compilers vs. interpreters e. syntax, semantics f. errors i. syntax ii. run-time
More informationCONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction
CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics COMP-202 Unit 1: Introduction Assignment 1 Assignment 1 posted on WebCt and course website. It is due September 22nd
More informationRepetition Structures
Repetition Structures Chapter 5 Fall 2016, CSUS Introduction to Repetition Structures Chapter 5.1 1 Introduction to Repetition Structures A repetition structure causes a statement or set of statements
More informationCondition-Controlled Loop. Condition-Controlled Loop. If Statement. Various Forms. Conditional-Controlled Loop. Loop Caution.
Repetition Structures Introduction to Repetition Structures Chapter 5 Spring 2016, CSUS Chapter 5.1 Introduction to Repetition Structures The Problems with Duplicate Code A repetition structure causes
More informationJava Programming. Computer Science 112
Java Programming Computer Science 112 Last week in Teeball I defined the three objects for you (use them!) Ball - Set/Get DistanceHit Batter - SwingAtBall Fielder - FieldBall So the main difficulty is
More informationThe following content is provided under a Creative Commons license. Your support
MITOCW Lecture 9 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high-quality educational resources for free. To make a donation
More informationA PROGRAM IS A SEQUENCE of instructions that a computer can execute to
A PROGRAM IS A SEQUENCE of instructions that a computer can execute to perform some task. A simple enough idea, but for the computer to make any use of the instructions, they must be written in a form
More informationDrumming Up Control. Traffic Control
Column #110 June 2004 by Jon Williams: Drumming Up Control Like most men, I'm not real big on the idea of shopping. I know what I want, I want what I want, and I know where to go get it and that's precisely
More informationThese are notes for the third lecture; if statements and loops.
These are notes for the third lecture; if statements and loops. 1 Yeah, this is going to be the second slide in a lot of lectures. 2 - Dominant language for desktop application development - Most modern
More informationWho am I? I m a python developer who has been working on OpenStack since I currently work for Aptira, who do OpenStack, SDN, and orchestration
Who am I? I m a python developer who has been working on OpenStack since 2011. I currently work for Aptira, who do OpenStack, SDN, and orchestration consulting. I m here today to help you learn from my
More informationCMSC131. Exceptions and Exception Handling. When things go "wrong" in a program, what should happen.
CMSC131 Exceptions and Exception Handling When things go "wrong" in a program, what should happen. Go forward as if nothing is wrong? Try to handle what's going wrong? Pretend nothing bad happened? Crash
More informationPrintable View of: Week 13: Miscelaneous cool features. Returns from standard functions. returns from standard functions: scanf(), fopen()
1 of 6 9/11/2009 12:57 PM Printable View of: Week 13: Miscelaneous cool features Print Save to File File: returns from standard functions: scanf(), fopen() returns from standard functions: scanf(), fopen()
More informationCSE : Python Programming. Homework 5 and Projects. Announcements. Course project: Overview. Course Project: Grading criteria
CSE 399-004: Python Programming Lecture 5: Course project and Exceptions February 12, 2007 Announcements Still working on grading Homeworks 3 and 4 (and 2 ) Homework 5 will be out by tomorrow morning I
More informationHomework 11. Project 1: Wizardry
Homework 11 Project 1: Wizardry You need to Factory create a Character class for an old school RPG. Characters can be Fighter, Thief, Mage. They can also specialize and be a Barbarian, Swashbuckler, or
More informationIntro. Scheme Basics. scm> 5 5. scm>
Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if
More informationCOMP 202 Java in one week
COMP 202 Java in one week... Continued CONTENTS: Return to material from previous lecture At-home programming exercises Please Do Ask Questions It's perfectly normal not to understand everything Most of
More informationCS 11 Haskell track: lecture 1
CS 11 Haskell track: lecture 1 This week: Introduction/motivation/pep talk Basics of Haskell Prerequisite Knowledge of basic functional programming e.g. Scheme, Ocaml, Erlang CS 1, CS 4 "permission of
More informationPost Experiment Interview Questions
Post Experiment Interview Questions Questions about the Maximum Problem 1. What is this problem statement asking? 2. What is meant by positive integers? 3. What does it mean by the user entering valid
More informationAzon Master Class. By Ryan Stevenson Guidebook #5 WordPress Usage
Azon Master Class By Ryan Stevenson https://ryanstevensonplugins.com/ Guidebook #5 WordPress Usage Table of Contents 1. Widget Setup & Usage 2. WordPress Menu System 3. Categories, Posts & Tags 4. WordPress
More informationComputer Programming. Basic Control Flow - Loops. Adapted from C++ for Everyone and Big C++ by Cay Horstmann, John Wiley & Sons
Computer Programming Basic Control Flow - Loops Adapted from C++ for Everyone and Big C++ by Cay Horstmann, John Wiley & Sons Objectives To learn about the three types of loops: while for do To avoid infinite
More informationPart 1 Your First Function
California State University, Sacramento College of Engineering and Computer Science and Snarky Professors Computer Science 10517: Super Mega Crazy Accelerated Intro to Programming Logic Spring 2016 Activity
More informationCS 115 Data Types and Arithmetic; Testing. Taken from notes by Dr. Neil Moore
CS 115 Data Types and Arithmetic; Testing Taken from notes by Dr. Neil Moore Statements A statement is the smallest unit of code that can be executed on its own. So far we ve seen simple statements: Assignment:
More information4. Java Project Design, Input Methods
4-1 4. Java Project Design, Input Methods Review and Preview You should now be fairly comfortable with creating, compiling and running simple Java projects. In this class, we continue learning new Java
More informationText Input and Conditionals
Text Input and Conditionals Text Input Many programs allow the user to enter information, like a username and password. Python makes taking input from the user seamless with a single line of code: input()
More informationProblem 1. Remove consecutive duplicates (6 points, 11 mintues)
Problem 1. Remove consecutive duplicates (6 points, 11 mintues) CS3 Fall 04 Midterm 2 Consider a function remove-conseq-dups that takes a sentence and returns a sentence in which any occurrences of a word
More informationHello World! Computer Programming for Kids and Other Beginners. Chapter 1. by Warren Sande and Carter Sande. Copyright 2009 Manning Publications
Hello World! Computer Programming for Kids and Other Beginners by Warren Sande and Carter Sande Chapter 1 Copyright 2009 Manning Publications brief contents Preface xiii Acknowledgments xix About this
More informationProblem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur
Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Lecture 18 Switch Statement (Contd.) And Introduction to
More informationHow to skin Rainlendar 2 Posted by he_the_great /11/01 16:03
How to skin Rainlendar 2 Posted by he_the_great - 2006/11/01 16:03 Rainy hasn't documented the skinning of RL2 yet, so I thought I would start with explaining some general aspects of it relating to the
More informationIt Might Be Valid, But It's Still Wrong Paul Maskens and Andy Kramek
Seite 1 von 5 Issue Date: FoxTalk July 2000 It Might Be Valid, But It's Still Wrong Paul Maskens and Andy Kramek This month, Paul Maskens and Andy Kramek discuss the problems of validating data entry.
More informationThe NetBeans IDE is a big file --- a minimum of around 30 MB. After you have downloaded the file, simply execute the file to install the software.
Introduction to Netbeans This document is a brief introduction to writing and compiling a program using the NetBeans Integrated Development Environment (IDE). An IDE is a program that automates and makes
More informationint main() { int account = 100; // Pretend we have $100 in our account int withdrawal;
Introduction to Exceptions An exception is an abnormal condition that occurs during the execution of a program. For example, divisions by zero, accessing an invalid array index, or ing to convert a letter
More informationPart 1 Simple Arithmetic
California State University, Sacramento College of Engineering and Computer Science Computer Science 10A: Accelerated Introduction to Programming Logic Activity B Variables, Assignments, and More Computers
More informationThe following content is provided under a Creative Commons license. Your support
MITOCW Lecture 2 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To make a donation
More informationPROFESSOR: Well, now that we've given you some power to make independent local state and to model objects,
MITOCW Lecture 5B PROFESSOR: Well, now that we've given you some power to make independent local state and to model objects, I thought we'd do a bit of programming of a very complicated kind, just to illustrate
More informationCS 463 Project 1 Imperative/OOP Fractals
CS 463 Project 1 Imperative/OOP Fractals The goal of a couple of our projects is to compare a simple project across different programming paradigms. This semester, we will calculate the Mandelbrot Set
More informationCS 115 Lecture 4. More Python; testing software. Neil Moore
CS 115 Lecture 4 More Python; testing software Neil Moore Department of Computer Science University of Kentucky Lexington, Kentucky 40506 neil@cs.uky.edu 8 September 2015 Syntax: Statements A statement
More informationDebugging. CSE 2231 Supplement A Annatala Wolf
Debugging CSE 2231 Supplement A Annatala Wolf Testing is not debugging! The purpose of testing is to detect the existence of errors, not to identify precisely where the errors came from. Error messages
More informationBlitz2D Newbies: Definitive Guide to Types by MutteringGoblin
Blitz2D Newbies: Definitive Guide to Types by MutteringGoblin Types are probably the hardest thing to understand about Blitz Basic. If you're using types for the first time, you've probably got an uneasy
More informationSelec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal
Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal Lesson Goals Understand Control Structures Understand how to control the flow of a program
More informationCOMP-202 Unit 4: Programming with Iterations
COMP-202 Unit 4: Programming with Iterations Doing the same thing again and again and again and again and again and again and again and again and again... CONTENTS: While loops Class (static) variables
More informationUnderstandable manual? Posted by Max Besser - 02 Feb :10
Understandable manual? Posted by Besser - 02 Feb 2011 17:10 www.lightworksbeta.com/index.php?option=com_kunena&func=view&catid=6&id=5100& amp;limit=6&limitstart=6&itemid=202#5167 Forum Admin wrote: @ Besser
More information! definite loop: A loop that executes a known number of times. " The for loops we have seen so far are definite loops. ! We often use language like
Indefinite loops while loop! indefinite loop: A loop where it is not obvious in advance how many times it will execute.! We often use language like " "Keep looping as long as or while this condition is
More information3 The L oop Control Structure
3 The L oop Control Structure Loops The while Loop Tips and Traps More Operators The for Loop Nesting of Loops Multiple Initialisations in the for Loop The Odd Loop The break Statement The continue Statement
More informationPROFESSOR: Last time, we took a look at an explicit control evaluator for Lisp, and that bridged the gap between
MITOCW Lecture 10A [MUSIC PLAYING] PROFESSOR: Last time, we took a look at an explicit control evaluator for Lisp, and that bridged the gap between all these high-level languages like Lisp and the query
More informationCONTENTS: While loops Class (static) variables and constants Top Down Programming For loops Nested Loops
COMP-202 Unit 4: Programming with Iterations Doing the same thing again and again and again and again and again and again and again and again and again... CONTENTS: While loops Class (static) variables
More informationWhat's the Slope of a Line?
What's the Slope of a Line? These lines look pretty different, don't they? Lines are used to keep track of lots of info -- like how much money a company makes. Just off the top of your head, which of the
More informationCMSC 201 Fall 2016 Lab 09 Advanced Debugging
CMSC 201 Fall 2016 Lab 09 Advanced Debugging Assignment: Lab 09 Advanced Debugging Due Date: During discussion Value: 10 points Part 1: Introduction to Errors Throughout this semester, we have been working
More informationFinding and Fixing Bugs
C Finding and Fixing Bugs C.1 Introduction As you will quickly find the BUG is the pain of all programmers existence. This section looks at the most common types of BUGS and some of the strategies for
More informationDiscussion 1H Notes (Week 3, April 14) TA: Brian Choi Section Webpage:
Discussion 1H Notes (Week 3, April 14) TA: Brian Choi (schoi@cs.ucla.edu) Section Webpage: http://www.cs.ucla.edu/~schoi/cs31 More on Arithmetic Expressions The following two are equivalent:! x = x + 5;
More informationGetting Started. Excerpted from Hello World! Computer Programming for Kids and Other Beginners
Getting Started Excerpted from Hello World! Computer Programming for Kids and Other Beginners EARLY ACCESS EDITION Warren D. Sande and Carter Sande MEAP Release: May 2008 Softbound print: November 2008
More informationCS3 Midterm 1 Fall 2006
Overall, you did good job on this exam. CS3 Midterm 1 Fall 2006 Standards and Solutions 20 10 0 8.0 30.0 28.0 26.0 24.0 22.0 20.0 18.0 16.0 14.0 12.0 10.0 Std. Dev = 5.34 Mean = 21.6 N = 133.00 MT1_SCL
More informationProgramming with Java
Programming with Java Variables and Output Statement Lecture 03 First stage Software Engineering Dep. Saman M. Omer 2017-2018 Objectives ü Declare and assign values to variable ü How to use eclipse ü What
More informationSlide 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 informationCS 170 Java Tools. Step 1: Got Java?
CS 170 Java Tools This semester in CS 170 we'll be using the DrJava Integrated Development Environment. You're free to use other tools but this is what you'll use on your programming exams, so you'll need
More informationNote: This is a miniassignment and the grading is automated. If you do not submit it correctly, you will receive at most half credit.
Com S 227 Fall 2017 Miniassignment 1 50 points Due Date: Monday, October 16, 11:59 pm (midnight) Late deadline (25% penalty): Tuesday, October 17, 11:59 pm General information This assignment is to be
More informationLecture 3: Recursion; Structural Induction
15-150 Lecture 3: Recursion; Structural Induction Lecture by Dan Licata January 24, 2012 Today, we are going to talk about one of the most important ideas in functional programming, structural recursion
More informationWhat did we talk about last time? Course overview Policies Schedule
Week 1 - Wednesday What did we talk about last time? Course overview Policies Schedule The book talks about stuff that you know pretty well as Java programmers I just want to talk about a few issues
More informationPython for Analytics. Python Fundamentals RSI Chapters 1 and 2
Python for Analytics Python Fundamentals RSI Chapters 1 and 2 Learning Objectives Theory: You should be able to explain... General programming terms like source code, interpreter, compiler, object code,
More informationThe following content is provided under a Creative Commons license. Your support
MITOCW Recitation 4 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To make
More informationAn attribute used in HTML that is used for web browsers screen reading devices to indicate the presence and description of an image Module 4
HTML Basics Key Terms Term Definition Introduced In A tag used in HTML that stands for Anchor and is used for all types of hyperlinks Module 3 A tag used in HTML to indicate a single line break
More informationLecture Transcript While and Do While Statements in C++
Lecture Transcript While and Do While Statements in C++ Hello and welcome back. In this lecture we are going to look at the while and do...while iteration statements in C++. Here is a quick recap of some
More informationRepe$$on CSC 121 Spring 2017 Howard Rosenthal
Repe$$on CSC 121 Spring 2017 Howard Rosenthal Lesson Goals Learn the following three repetition structures in Java, their syntax, their similarities and differences, and how to avoid common errors when
More informationEXCEPTIONS. Fundamentals of Computer Science I
EXCEPTIONS Exception in thread "main" java.lang.numberformatexception: For input string: "3.5" at java.lang.numberformatexception.forinputstring(numberformatexception.java:48) at java.lang.integer.parseint(integer.java:458)
More informationModule 2: Choice and Iteration
Module 2: Choice and Iteration Ron K. Cytron * Department of Computer Science and Engineering * Washington University in Saint Louis Thanks to Alan Waldman for comments that improved these slides Prepared
More informationVersion Copyright Feel free to distribute this guide at no charge...
Version 2.0 Feel free to distribute this guide at no charge... You cannot edit or modify this guide in anyway. It must be left exactly the way it is. This guide is only accurate from the last time it was
More informationP1_L3 Operating Systems Security Page 1
P1_L3 Operating Systems Security Page 1 that is done by the operating system. systems. The operating system plays a really critical role in protecting resources in a computer system. Resources such as
More informationHow to Create a Killer Resources Page (That's Crazy Profitable)
How to Create a Killer Resources Page (That's Crazy Profitable) There is a single page on your website that, if used properly, can be amazingly profitable. And the best part is that a little effort goes
More informationThe exact swipes that can increase your sales and profits by a factor of 10x in just 72 hours flat.
2015 HIGHER LEVEL STRATEGIES INC. The exact email swipes that can increase your sales and profits by a factor of 10x in just 72 hours flat. NOTE: My results are not typical. Your results will vary. Be
More informationSlide 1 CS 170 Java Programming 1 The while Loop Duration: 00:00:60 Advance mode: Auto
CS 170 Java Programming 1 The while Loop Writing Counted Loops and Loops that Check a Condition Slide 1 CS 170 Java Programming 1 The while Loop Duration: 00:00:60 Hi Folks. Welcome to the CS 170, Java
More informationChapter Goals. Contents LOOPS
CHAPTER 4 LOOPS Slides by Donald W. Smith TechNeTrain.com Final Draft Oct 30, 2011 Chapter Goals To implement while, for, and do loops To hand-trace the execution of a program To become familiar with common
More informationTips from the experts: How to waste a lot of time on this assignment
Com S 227 Spring 2018 Assignment 1 100 points Due Date: Friday, September 14, 11:59 pm (midnight) Late deadline (25% penalty): Monday, September 17, 11:59 pm General information This assignment is to be
More informationRelational Operators EXAMPLE. C++ By
C++ By 9 EXAMPLE Relational Operators Sometimes you won t want every statement in your C++ program to execute every time the program runs. So far, every program in this book has executed from the top and
More information10 Strategies for Effective Marketing Campaigns
10 Strategies for Effective Email Marketing Campaigns Most people do not send effective email messages. I know. I spend a lot of time analyzing email messages for our clients, and measuring and tracking
More information