59 Pages

06-iteration

Course: CS 101, Fall 2008
School: UVA
Rating:
 
 
 
 
 

Word Count: 2469

Document Preview

1 Java Iteration looping Options while dowhile for Allow programs to control how many times a statement list is executed 2 Averaging Problem Extract a list of positive numbers from standard input and produce their average Numbers are one per line A negative number acts as a sentinel to indicate that there are no more numbers to process Observations Cannot supply sufficient code using...

Register Now

Unformatted Document Excerpt

Coursehero >> Virginia >> UVA >> CS 101

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
1 Java Iteration looping Options while dowhile for Allow programs to control how many times a statement list is executed 2 Averaging Problem Extract a list of positive numbers from standard input and produce their average Numbers are one per line A negative number acts as a sentinel to indicate that there are no more numbers to process Observations Cannot supply sufficient code using just assignments and conditional constructs to solve the problem Don't how big of a list to process Need ability to repeat code as needed 3 Averaging Algorithm Prepare for processing Get first input While there is an input to process do { Process current input Get the next input } Perform final processing 4 Averaging Problem Extract a list of positive numbers from standard input and produce their average Numbers are one per line A negative number acts as a sentinel to indicate that there are no more numbers to process Sample run Enter positive numbers one per line. Indicate end of list with a negative number. 4.5 0.5 1.3 1 Average 2.1 5 public class NumberAverage { // main(): application entry point public static void main(String[] args) { // set up the input // prompt user for values // get first value // process values onebyone while (value >= 0) { // add value to running total // processed another value // prepare next iteration get next value } // display result if (valuesProcessed > 0) // compute and display average else // indicate no average to display } } int valuesProcessed = 0; double valueSum = 0; // set up the input Scanner stdin = new Scanner (System.in); // prompt user for values notice the format! System.out.println("Enter positive numbers 1 per line.\n" + "Indicate end of the list with a negative number."); // get first value double value = stdin.nextDouble(); // process values onebyone while (value >= 0) { valueSum += value; ++valuesProcessed; value = stdin.nextDouble(); } // display result if (valuesProcessed > 0) { double average = valueSum / valuesProcessed; System.out.println("Average: " + average); } else { System.out.println("No list to average"); } While syntax and semantics while ( Expression ) Action Logical expression that determines whether Action is to be executed Action is either a single statement or a statement list within braces 8 While semantics for averaging problem Test expression is evaluated at the start of each iteration of the loop. // process values onebyone while ( value >= 0 ) { // add value to running total valueSum += value; // we processed another value ++valueProcessed; // prepare to iterate get the next input value = stdin.nextDouble(); } If test expression is true, these statemen are executed. Afterward, the test express is reevaluated and the process repeats 9 While Semantics Expression is evaluated at the start of each iteration of the loop Expression If Expression is true, Action is executed true false Action If Expression is false, program execution continues with next statement 10 Suppose input contains: 4.5 0.5 1.3 1 Execution Trace int valuesProcessed = 0; double valueSum = 0; valuesProcessed valueSum value 3 2 1 0 4.5 6.3 5.0 0 1.3 0.5 4.5 1 double value = stdin.nextDouble(); while (value >= 0) { valueSum += value; ++valuesProcessed; value = stdin.nextDouble(); } average 2.1 if (valuesProcessed > 0) { double average = valueSum / valuesProcessed; System.out.println("Average: " + average); } else { System.out.println("No list to average"); } 11 Converting text to strictly lowercase public static void main(String[] args) { Scanner stdin = new Scanner (System.in); System.out.println("Enter input to be converted:"); String converted = ""; String currentLine = stdin.nextLine(); while (currentLine != null) { String currentConversion = currentLine.toLowerCase(); converted += (currentConversion + "\n"); currentLine = stdin.nextLine(); } } System.out.println("\nConversion is:\n" + converted); 12 Sample run An empty line was entered A Ctrl+z was entered. I the t is Windows escape sequence for indicating end-of-file 13 Program trace public static void main(String[] args) { Scanner stdin = new Scanner (System.in); System.out.println("Enter input to be converted:"); String converted = ""; String currentLine = stdin.nextLine(); while (currentLine != null) { String currentConversion = currentLine.toLowerCase(); converted += (currentConversion + "\n"); currentLine = stdin.nextLine(); } } System.out.println("\nConversion is:\n" + converted); 14 Program trace The append assignment operator updates the representation of converted to include the current input line onverted += (currentConversion + "\n"); Representation of lower case conversion of current input line Newline character is needed because method nextLine() "strips" them from the input 15 Converting text to strictly lowercase public static void main(String[] args) { Scanner stdin = new Scanner (System.in); System.out.println("Enter input to be converted:"); String converted = ""; String currentLine = stdin.nextLine(); while (currentLine != null) { String currentConversion = currentLine.toLowerCase(); converted += (currentConversion + "\n"); currentLine = stdin.nextLine(); } } System.out.println("\nConversion is:\n" + converted); 16 All your base are belong to us Flash animation Reference: http://en.wikipedia.org/wiki/All_your_base_are_belong_to_us 17 Loop design Questions to consider in loop design and analysis What initialization is necessary for the loop's test expression? What initialization is necessary for the loop's processing? What causes the loop to terminate? What actions should the loop perform? What actions are necessary to prepare for the next iteration of the loop? What conditions are true and what conditions are false when the loop is terminated? When the loop completes what actions are need to prepare for subsequent program processing? 18 Reading a file Background Same Scanner class! filename is a String canner fileIn = new Scanner (new File (filename) ); The File class allows access to files It's in the java.io package 19 Reading a file Class File Allows access to files (etc.) on a hard drive Constructor File (String s) Opens the file with name s so that values can be extracted Name can be either an absolute pathname or a pathname relative to the current working folder 20 Reading a file Scanner stdin = new Scanner (System.in); System.out.print("Filename: "); String filename = stdin.nextLine(); Scanner fileIn = new Scanner (new File (filename)); String currentLine = fileIn.nextLine(); while (currentLine != null) { System.out.println(currentLine); currentLine = fileIn.nextLine(); } Get next line Get first line Process lines one by one Set up file stream Display current line Close the file stream Determine file name Make sure got a line to process Set up standard input stream If not, loop is done 21 The For Statement The body of the loop iterates while the test expression is true Initialization step is performed only currentTerm = 1; After each iteration of the once -- just priorint body of the loop, the update to the first expression is reevaluated evaluationfor ( int i = 0; i < 5; ++i ) { of the test expression System.out.println(currentTerm); currentTerm *= 2; The body of the loop displays the } current term in the number series. It then determines what is to be the new current number in the series 22 Evaluated once at the beginning of the for statements's execution ForInit The ForExpr is evaluated at the start of each iteration of the loop If ForExpr is true, Action is executed After the Action has completed, the PostExpression is evaluated ForExpr true false Action If ForExpr is false, program execution continues with next statement PostExpr After evaluating the PostExpression, the next iteration of the loop starts for statement syntax Logical test expression that determines whether the action and update step are executed Initialization step prepares for the first evaluation of the test expression Update step is performed after the execution of the loop body ForInit ; ForExpression ; ForUpdate ) Action for ( The body of the loop iterates whenever the test expression evaluates to true 24 for vs. while A for statement is almost like a while statement for ( ForInit; ForExpression; ForUpdate ) Action is ALMOST the same as: ForInit; while ( ForExpression ) { Action; ForUpdate; } This is not an absolute equivalence! We'll see when they are different below 25 Variable declaration You can declare a variable in any block: Variable n gets created (and initialized) each time Thus, println() always prints out 1 Variable n is not defined once while loop ends while ( true ) { int n = 0; n++; System.out.println } (n); System.out.println (n); As n is not defined here, this causes an error 26 Variable declaration You can declare a variable in any block: if ( true ) { int n = 0; n++; System.out.println (n); } System.out.println (n); Only difference from last slide 27 End of lecture on 1 November 2004 28 Execution Trace for ( int i = 0; i < 3; ++i ) { i 3 2 1 0 System.out.println("i is " + i); } System.out.println("all done"); i is 0 i is 1 i is 2 all done Variable i has gone out of scope it is local to the loop 29 for vs. while An example when a for loop can be directly translated into a while loop: int count; for ( count = 0; count < 10; count++ ) { System.out.println (count); } Translates to: int count; count = 0; while (count < 10) { System.out.println (count); count++; } 30 for vs. while An example when a for loop CANNOT be directly translated into a while loop: only difference for ( int count = 0; count < 10; count++ ) { System.out.println (count); } Would translate as: count is NOT defined here int count = 0; while (count < 10) { System.out.println (count); count++; } count IS defined here 31 for loop indexing Java (and C and C++) indexes everything from zero Thus, a for loop like this: for ( int i = 0; i < 10; i++ ) { ... } Will perform the action with i being value 0 through 9, but not 10 To do a for loop from 1 to 10, it would look like this: for ( int i = 1; i <= 10; i++ ) { ... } 32 Nested loops int m = 2; int n = 3; for (int i = 0; i < n; ++i) { System.out.println("i is " + i); for (int j = 0; j < m; ++j) { System.out.println(" j is " + j); } i is 0 } j is 0 j is 1 i is 1 j is 0 j is 1 i is 2 j is 0 j is 1 33 Nested loops int m = 2; int n = 4; for (int i = 0; i < n; ++i) { System.out.println("i is " + i); for (int j = 0; j < i; ++j) { System.out.println(" j is " + j); } } i is 0 i is 1 j is 0 i is 2 j is 0 j is 1 i is 3 j is 0 j is 1 j is 2 34 The dowhile statement Syntax do Action while (Expression) Semantics Execute Action If Expression is true then execute Action again Repeat this process until Expression evaluates to false Action is either a single statement or a group of statements within braces Action true Expression false 35 Picking off digits Consider System.out.print("Enter a positive number: "); int number = stdin.nextInt(); do { int digit = number % 10; System.out.println(digit); number = number / 10; } while (number != 0); Sample behavior Enter a positive number: 1129 9 2 1 1 36 while vs. dowhile If the condition is false: while will not execute the action dowhile will execute it once while ( false ) { System.out.println ("foo"); } do { System.out.println ("foo"); } while ( false ); never executed executed once 37 while vs. dowhile A dowhile statement can be translated into a while statement as follows: do { Action; } while ( WhileExpression ); can be translated into: boolean flag = true; while ( flag || WhileExpression ) { flag = false; Action; } 38 End of lecture on 3 November 2004 We watched the Kerry concession speech and the Bush acceptance speech in class today, so after the announcements, we only got to about 2025 minutes of actual lecture time 39 A digression: Perl again Consider the statement: if ( !flag ) { ... } else { ... } Perl has a command unless: unless ( flag ) { ... } else { ... } An unless command is a if statement with a negated condition It can get a bit confusing, though The else of an unless... 40 A digression: Perl again Consider the statement: while ( !flag ) { ... } Perl has a command until: until ( flag ) { ... } An until command is a while loop with a negated condition As most people are quite used to ifelse and while, unless and until are rarely used 41 Problem solving 42 Data set manipulation Often five values of particular interest Minimum Maximum Mean Standard deviation Size of data set Let's design a data set representation The data set represents a series of numbers Note that the numbers themselves are not remembered by the DataSet Only properties of the set (average, minimum, etc.) 43 Implication on facilitators public double getMinimum() Returns the minimum value in the data set. If the data set is empty, then Double.NaN is returned, where Double.NaN is the Java double value representing the status notanumber public double getMaximum() Returns the maximum value in the data set. If the data set is empty, then Double.NaN is returned 44 Implication on facilitators public double getAverage() Returns the average value in the data set. If the data set is empty, then Double.NaN is returned public double getStandardDeviation() Returns the standard deviation value of the data set. If the data set is empty, then Double.NaN is returned Left to the interested student public int getSize() Returns the number of values in the data set being represented 45 Constructors public DataSet() Initializes a representation of an empty data set public DataSet(String s) Initializes the data set using the values from the file with name s public DataSet(File filep) Initializes the data set ...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

UVA - CS - 101
ClassesCS 101E Chapter 4 Aaron Bloomfield 1Announcements HWs are being renumbered J1, J2, etc., for Java programming assignments C1, C2, etc., for CodeLab assignments HW1 = J1, HW2 = C1, HW3 = C2, etc. HWs J2 and J3 assigned this
UVA - CS - 101
JavabasicsChapter2 CS101E1DisplayForecast.java/Authors:J.P.CohoonandJ.W.Davidson /Purpose:displayaquotationinaconsolewindow publicclassDisplayForecast{Threecomments/methodmain():applicationentrypoint publicstaticvoidmain(String[]args){ Sy
UVA - CS - 101
Even even more on being classyAaron Bloomfield CS 101-E Chapter 4+1Consider this sequence of events.2What happened? Javadidn't &quot;repaint&quot; the rectangles when necessary Javaonly painted the rectangle once Youcan tell Java to repaint i
UVA - CS - 101
ReviewofHWJ3AaronBloomfield CS101EStrandrepresentationStrand nucleotideSequence= String text=tgccagt tgccagt length=7publicStrandslice(inti1,inti2) publicStrand() publicStrand() +length():int publicStrand(Strings) publicStrand(Strings) +charAt
UVA - CS - 101
Visibilities and Static-nessAaron Bloomfield CS 101-EOur Circle classWe are going to write a Circle class Somebody else is going to use it public class Circle { double radius; double Pi = 3.1415926536; }Note the fields are not static Note the ra
UVA - CS - 101
221nosotros weesperamos hopeque that/whatpuede canuna aoracin sentenceleo logleno logzorro foxrpido quickmarrn brownsalt jumpedsalto jumpedsobre overregistro data-logperezoso lazyo orsusyourprofesores professorsestudiantestudent
UVA - CS - 101
A B CD E FThis file has 42 characters.
UVA - CS - 101
/ Authors: J. P. Cohoon and J. W. Davidson/ Purpose: display a quotation in a console windowpublic class DisplayForecast {/ method main(): application entry pointpublic static void main(String[] args) {System.out.print(&quot;I think ther
UVA - CS - 101
CS 101 / CS 101-EFall 2005 http:/www.cs.virginia.edu/~cs101M/W 2:00-3:15 CHM 402 / OLS 009Instructors: CS 101 Aaron Bloomfield http:/www.cs.virginia.edu/~asbCS 101-E David Luebke http:/www.cs.virginia.edu/~luebkeOffice: Olsson Hall, room 228D
UVA - CS - 101
CS 101 / CS 101-EFall 2006 http:/www.cs.virginia.edu/~cs101 CS 101: M/W 2:00-3:15 in CHM 402 CS 101-E: M/W 3:30-4:45 in MEC 341Instructors: CS 101 Aaron Bloomfield http:/www.cs.virginia.edu/~asb Office: Olsson Hall, room 228D Office hours are poste
UVA - CS - 202
CS 202, Discrete Math Spring 2007Mondays and Wednesdays 1:00-1:50 Recitation on Fridays at 11:00 or 1:00Instructor: Aaron Bloomfield. Office: Olsson Hall, room 228D ( Course web page: http:/www.cs.virginia.edu/~cs202/ Introduction: This class will
UVA - CS - 494
CS 494 Homework 3: Due 27 March 2006In this homework, you will complete the second elaboration iteration for the project you described in the first homework. In particular, you will have another functioning version of your system ready by the end o
UVA - CS - 202
CS/APMA 202, Spring 2005Tu/Th 3:30-4:45 Olsson Hall room 120Instructor: Aaron Bloomfield. Office: Olsson Hall, room 228D ( Course web page: http:/www.cs.virginia.edu/~asb/cs202/ Introduction: This class will probably be different than any other mat
UVA - CS - 445
CS 445: Computer GraphicsFall 2006 http:/www.cs.virginia.edu/~cs445 Instructor Aaron Bloomfield http:/www.cs.virginia.edu/~asb Office: Olsson Hall, room 228D Office hours are posted on the website Teaching Assistant Jason Mars http:/www.cs.virginia.
UVA - CS - 415
Wed 02 Nov 2005 02:01:06 AM ESTmodpow.htmlPage 1&lt;!DOCTYPE html PUBLIC &quot;-/W3C/DTD XHTML 1.0 Transitional/EN&quot; &quot;http:/www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt; &lt;html xmlns=&quot;http:/www.w3.org/1999/xhtml&quot; lang=&quot;en-US&quot; xml:lang= &quot;en-US&quot;&gt; &lt;hea
UVA - CS - 415
CS 415: Programming Languages Homework 2: Ocaml Due Friday, 23 September by 10 a.m.For this homework, you will need to write three Ocaml functions that deal with DFAs and NFAs: dfasimulate: given a DFA and input, will return the state transition of
UVA - CS - 415
CS 415: Programming Languages Homework 1: Fortran Due Friday, 9 September by 10 a.m.For this homework, you will need to write a Fortran program that will compute whether a circle and a triangle intersect. The program will get (as user input) the loc
UVA - CS - 494
CS 494 Homework 5: Due 2 May 2006In this homework, you will complete the fourth (and last!) elaboration iteration for the project you described in the first homework. In particular, you will have the completed version of your project ready by the e
UVA - CS - 494
CS 494 Homework 1: Due 13 Feb 2006For this homework, you will generate a proposal for a project that you will be working on throughout the semester. Essentially, you will be going through the inception phase for your project. You can work in groups
UVA - CS - 494
CS 494: Object Oriented DesignSpring 2006 http:/www.cs.virginia.edu/~cs494M/W/F 12:00-12:50 MEC 339Instructor: Aaron Bloomfield http:/www.cs.virginia.edu/~asb Office: Olsson Hall, room 228D Office hours are posted on the website Other course pers
UVA - CS - 101
CS 101 Fall 2005 Final ExamName: _Email ID: _This exam is open text book but closed-notes, closed-calculator, closed-neighbor, etc. Unlike midterm exams, you have a full 3 hours to work on this exam. This final exam is optional; you may choose
UVA - CS - 494
CS 494 Homework 2: Due 27 Feb 2006In this homework, you will complete the first elaboration iteration for the project you described in the first homework. In particular, you will have a fully functioning prototype version of your system ready by th
UVA - CS - 202
CS/APMA 202Midterm 27 April 2005Name: _E-mail ID: _@virginia.eduPledge: _ __ _ Signature: _There are 75 minutes for this exam and 100 points on the test; don't spend too long on any one question! The 12 short answer questions require only
UVA - CS - 101
CS 101 Fall 2005 Midterm 1Name: _Email ID: _This exam is open text book but closed-notes, closed-calculator, closed-neighbor, etc. Questions are worth different amounts (in particular, the final question is worth substantially more than any oth
UVA - CS - 101
CS101 Fall 2005 Midterm 2 Grading GuidelinesQuestion 3: 4 points, each answer worth 1 point Question 4: 3 points, there should be 3 numbers output, each worth a point. Question 5: 3 points, one for each value (j,k, flag) Question 6: 5 points a. 3 va
UVA - CS - 101
CS 101 Spring 2006 Midterm 2Name: _Email ID: _This exam is open text book but closed-notes, closed-calculator, closed-neighbor, etc. Questions are worth different amounts, so be sure to look over all the questions and plan your time accordingly
UVA - CS - 101
Pledged CS 101 Exam 3 Spring 2005Email Id _ Name _This pledged exam is open text book and closed notes. Different questions have different points associated with them. Because your goal is to maximize your number of points, we recommend that you
UVA - CS - 101
CS 101 Final Exam Fall 2005Email Id _Name _This pledged exam is open text book and closed notes. Different questions have different points associated with them. Because your goal is to maximize your number of points, we recommend that you do not
UVA - CS - 415
CS 415 Midterm Exam Spring 2002Name _KEY _ Email Address _ Student ID # _Pledge:This exam is closed note, closed book. Good Luck!Score Fortran Algol 60 Compilation Names, Bindings, Scope Functional Programming Total/100CS415Anderson Sp
UVA - CS - 415
INTERCALAaron Bloomfield CS 415 Fall 2005A note about the sourcesThe main sources for this lecture set are:The INTERCAL page in Wikipediahttp:/en.wikipedia.org/wiki/IntercalThe INTERCAL Programming Language Revised Reference Manual
UVA - CS - 445
TransformationsAaron Bloomfield CS 445: Introduction to Graphics Fall 2006 (Slide set originally by David Luebke)Graphics coordinate systems X is red Y is green Z is blue2Graphics coordinate systemsIf you are on the +z axis, and +y is
UVA - CS - 415
Names, Scopes and BindingsAaron Bloomfield CS 415 Fall 200511Binding A binding is an association between two things, such as a name and the thing it represents Example: int x When this statement is compiled, x is bound to a memory space2B
UVA - CS - 415
Debuggers, Analysis Tools and ProfilersAaron Bloomfield CS 415 Fall 20051What is a Debugger?&quot;A software tool that is used to detect the source of program or script errors, by performing step-by-step execution of application code and viewing the
UVA - CS - 445
Rendering PipelineAaron Bloomfield CS 445: Introduction to Graphics Fall 2006 (Slide set originally by Greg Humphreys)3D Polygon RenderingMany applications use rendering of 3D polygons with direct illumination23D Polygon RenderingMany ap
UVA - CS - 445
LightingAaron Bloomfield CS 445: Introduction to Graphics Fall 2006Lighting Sogiven a 3-D triangle and a 3-D viewpoint, we can set the right pixels But what color should those pixels be? If were attempting to create a realistic image, we need
UVA - CS - 415
ScanningAaron Bloomfield CS 415 Fall 20051Parsing &amp; Scanning In real compilers the recognizer is split into two phases Scanner: translate input characters to tokens Also, report lexical errors like illegal characters and illegal symbols Pars
UVA - CS - 445
Rendering Pipeline and Graphics HardwareAaron Bloomfield CS 445: Introduction to Graphics Fall 2006Overview Framebuffers How is the rasterized Rendering Pipeline scene kept in memory? Transformations Lighting Clipping Modeling Camera Vis
UVA - CS - 202
Set OperationsCS/APMA 202, Spring 2005 Rosen, section 1.7 Aaron Bloomfield1Sets of ColorsMonitor gamut (M) Printer gamut (P) Pick any 3 &quot;primary&quot; colors Triangle shows mixable color range (gamut) the set of colors2Set operations: Union 1
UVA - CS - 415
In More Depth.Grammars Parsing(Slides copied liberally from Ruth Anderson, Hal Perkins and others)04/19/09CS415 - Fall 20051Parsing The syntax of most programming languages can be specified by a context-free grammar (CGF) Parsing: Given a
UVA - CS - 202
Nested QuantifiersCS/APMA 202, Spring 2005 Rosen, section 1.4 Aaron Bloomfield1Multiple quantifiersYou can have multiple quantifiers on a statement x y P(x, y) &quot;For all x, there exists a y such that P(x,y)&quot; Example: x y (x+y = 0) xy P(x,y)
UVA - CS - 445
CS 445 Introduction to Computer GraphicsFall 2006 Aaron BloomfieldOverviewIntroductionWhat is computer graphics? What is it good for? What will I learn in this course? How much work will there be?ApplicationsSyllabusCoursework
UVA - CS - 415
CS 415: Programming LanguagesAlgol Aaron Bloomfield Fall 2005Historical perspectiveBy mid/late 50s a lot of PLs were out there Interest in universal language European and American groups got together in Zurich Result was Algol 58 8 people spe
UVA - CS - 445
General-Purpose Computation on Graphics HardwareDavid LuebkeUniversity of VirginiaCourse Introduction The GPU on commodity video cards has evolved into an extremely flexible and powerful processor Programmability Precision Power We are in
UVA - CS - 445
RasterizationAaron Bloomfield CS 445: Introduction to Graphics Fall 2006 (Slide set originally by David Luebke)The Rendering Pipeline: A TourTransform Illuminate Transform Clip Project RasterizeMode &amp; C e l am ra Param te e rsRe ring Pipe nde
UVA - CS - 202
FunctionsCS 202 Epp section ? Aaron Bloomfield1Definition of a function A function takes an element from a set and maps it to a UNIQUE element in another set2Function terminologyf maps R to Z Domain R f Z Co-domainf(4.3) 4.3 4Pre-image
UVA - CS - 202
Propositional EquivalencesCS/APMA 202, Spring 2005 Rosen, section 1.2 Aaron Bloomfield1Tautology and ContradictionA tautology is a statement that is always truep p will always be true(Negation Law)A contradiction is a statement that is al
UVA - CS - 415
Objective Caml (Ocaml)Aaron Bloomfield CS 415 Fall 20051ML history ML first developed in late 1970's Stands for Meta Langauage Not a &quot;pure&quot; function language Has functions with side effects, imperative programming capabilities Haskell is a
UVA - CS - 202
Methods of ProofCS 202 Rosen section 1.5 Aaron Bloomfield1In this slide set.Rules of inference for propositions Rules of inference for quantified statements Ten methods of proof2Proof methods in this slide setLogical equivalences Ten pro
UVA - CS - 202
Boolean LogicCS 202, Spring 2007 Epp, sections 1.1 and 1.2 Aaron Bloomfield1Administratrivia HW 1: due next Friday Section 1.1 # 49, 52 Section 1.2 # 34, 44, 46 Today's lecture will be somewhat of a review Next week we will see applications
UVA - CS - 445
Making MoviesAaron Bloomfield CS 445: Introduction to Graphics Fall 2006 (Slide set originally by David Brogan)Making Movies Concept Storyboarding Sound Character Development Layout and look Effects Animation Lighting2Concept&quot;Not
UVA - CS - 101
GUI programmingGraphical user interfacebased programmingWindchill Windchill There are several formulas for calculating the windchill temperature twc The one provided by U.S. National Weather Service and is applicable for a windspeed greater tha
UVA - CS - 101
Fall 2004 - CS 101: Test 1Name _UVA Email ID _I. Computing and programming fundamentals1. (4 points) Give two examples of non-PC computing devices.Part I Part II Part III2. (4 points) What does Java program compilation do?Total3. (4 poin
UVA - CS - 101
Fall 2004 - CS 101: Test 3Name _UVA Email ID _Page 1 _ / 10 1. (Bonus 2 points) What is your section? 101 Page 4 _ / 17 101E Page 5 _ / 25 Page 6 _ / 20 Page 2 _ / 10 Page 3 _ / 18Total _ /100 2. (5 points) What is the output of the following c
UVA - CS - 101
CS 101 Exam 1 Spring 200Email Id _ Name _This exam is open text book and closed notes. Different questions have different points associated with them with later occurring questions having more worth than the beginning questions. Because your goal
UVA - CS - 101
CS 101 / CS 101-Ehttp:/www.cs.virginia.edu/~cs101M/W 2:00-3:15 CHM 402 / MEC 205Instructors: CS 101 Aaron Bloomfield http:/www.cs.virginia.edu/~asbCS 101-E James Cohoon http:/www.cs.virginia.edu/~cohoonOffice: Olsson Hall, room 228D Office: O
UVA - CS - 101
Take care with floating-point valuesConsider double a = 1; double b = 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 double c = .9999999999999999; Two true expressions! c = b b != a Two false expressions! a = b b != c Problem lies with th
UVA - CS - 101
Testing and ExceptionsException Abnormal event occurring during program execution Examples Manipulate nonexistent files File file = new File(s); Scanner fileIn = new Scanner(file); Improper array subscripting int[] a = new int[3]; a
UVA - CS - 101
BooleanvaluesGatewaytodecisionmakingBackground Ourproblemsolvingsolutionssofarhavethestraightlineproperty TheyexecutethesamestatementsforeveryrunoftheprogrampublicclassDisplayForecast /main():applicationentrypoint publicstaticvoidmain(String[]a
UVA - CS - 101
Cir cleKeeps on r ol l i ng Pr oblem design a cir cle r epr esent at ionSome possi bl e questi ons to ask What ki nd of ci r cl e? Why not use an exi sti ng ci r cl e r epr esentati on? What pl ans do you have for the ci r cl e? What
UVA - CS - 101
ClassesPreparation Scenesofarhasbeenbackgroundmaterialandexperience Computingsystemsandproblemsolving Variables Types Inputandoutput Expressions Assignments Objects StandardclassesandmethodsReady ExperiencewhatJavaisreallyabout Designa
UVA - CS - 101
Review for exam 1CS 101 Aaron Bloomfield1Todays lectureAn overview of the review sections of chapters 1-3 Stop me if you want me to go over something in more detail!2Material you may not be comfortable withConstructorsI know there is a