intro
13 Pages

intro

Course Number: CS 111, Fall 2009

College/University: BU

Word Count: 1360

Rating:

Document Preview

Introduction to Computer Science I Course Overview Programming in Java Computer Science 111 Boston University Spring 2009 David G. Sullivan, Ph.D. Welcome to CS 111! Computer science is not so much the science of computers as it is the science of solving problems using computers. Eric Roberts This course covers: the process of developing algorithms to solve problems the process of developing computer...

Unformatted Document Excerpt
Coursehero >> Massachusetts >> BU >> CS 111

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.

to Introduction Computer Science I Course Overview Programming in Java Computer Science 111 Boston University Spring 2009 David G. Sullivan, Ph.D. Welcome to CS 111! Computer science is not so much the science of computers as it is the science of solving problems using computers. Eric Roberts This course covers: the process of developing algorithms to solve problems the process of developing computer programs to express those algorithms Computer Science and Programming There are many different fields within CS, including: software systems computer architecture networking programming languages, compilers, etc. theory AI Experts in many of these fields dont do much programming! However, learning to program will help you to develop ways of thinking and solving problems used in all fields of CS. A Rigorous Introduction Intended for: CS, math, and physical science concentrators others who want a rigorous introduction no programming background required, but can also benefit people with prior background Allow for 10-15 hours of work per week start work early! Less rigorous alternatives include: CS 101: overview of CS, a bit of programming CS 105: databases and data mining 1/3 of course is learning to program in Python CS 108: a less rigorous intro. to programming also uses Python CS 111 Requirements Attendance at and participation in lectures and labs (10%) email us ahead of time if you have a conflict labs begin next week held in the CS teaching lab, EMA 304 complete Lab 0 sometime this week (see course website) Ten problem sets (40%) must be your own work: see syllabus for details Three quizzes (25%) no makeups, so please mark your calendars! Final exam (25%) Textbook Building Java Programs by Stuart Reges and Marty Stepp (Addison Wesley, 2008). were using a custom Boston University edition available at Barnes & Noble omits material that we don't cover cheaper! the standard edition is also fine Also required: The CS 111 Coursepack contains all of the lecture notes available at Fedex Kinkos on Cummington Street Course Staff Instructor: Dave Sullivan (dgs@cs.bu.edu) Teaching fellow: Tai-Peng Tian (tian@cs.bu.edu) Office hours and contact info. will be available on the course website: http://www.cs.bu.edu/courses/cs111 For general course-related questions, email: cs111-staff@cs.bu.edu which will forward your question to the full course staff. Other Details of the Syllabus Academic conduct Policies: lateness please don't request an extension unless it's an emergency! grading Please read the syllabus carefully and make sure that you understand the policies and follow them carefully. Let us know if you have any questions. Algorithms In order to solve a problem using a computer, you need to come up with one or more algorithms. An algorithm is a step-by-step description of how to accomplish a task. An algorithm must be: precise: specified in a clear and unambiguous way effective: capable of being carried out Example of Defining an Algorithm Algorithm for Finding My Office 1. Go to the entrance to the MCS (math/CS) building at 111 Cummington Street behind Warren Towers. (It is the pink part of the building.) 2. Cross the street to the pair of doors across from MCS. 3. Enter those doors and take an immediate right. Algorithm for Finding My Office (cont.) 4. Open the door to the stairway and go up to the second floor. 5. Upon exiting the stairs, turn right. 6. Take an immediate left into a small hallway. 7. My office is the first door on the left (PSY 228D). Programming Programming involves expressing an algorithm in a form that a computer can interpret. We will be using the Java programming language. one of many possible languages The key concepts of the course transcend this language. Programs and Classes In Java, all programs consist of one of more classes. For now: we'll limit ourselves to writing a single class you can just think of a class as a container for your program Example: a program that displays a simple message: public class HelloWorld { public static void main(String[] args) { System.out.println("hello, world"); } } A class must be defined in a file with a name of the form <classname>.java for the class above, the name would be HelloWorld.java Using an IDE An integrated development environment (IDE) is an application helps that you develop programs. Well use the Dr. Java IDE. Lab 0 tells you how to obtain and install it. Please do so ASAP. With an IDE, you do the following: use its built-in text editor to write your code instruct the IDE to compile the code instruct the IDE to run the program debug as needed, using the IDE's debugging tools Using Dr. Java Format of a Java Class General syntax: public class <name> { code goes here } where <name> is replaced by the name of the class. Notes: the class begins with a header: public class <name> the code inside the class is enclosed in curly braces ({ and }) Methods A method is a collection of instructions that perform some action or computation. Every Java program must include a method called main. contains the instructions that will be executed first when the program is run Our example program includes a main method with a single instruction: public class HelloWorld { public static void main(String[] args) { System.out.println("hello, world"); } } Methods (cont.) General syntax for the main method: public static void main(String[] args) { <statement>; <statement>; <statement>; } where each <statement> is replaced by a single instruction. Notes: the main method always begins with the same header: public static void main(String[] args) the code inside the method is enclosed in curly braces each statement typically ends with a semi-colon the statements are carried out (executed) sequentially, one after the other Identifiers Used to name the components of a Java program like classes and methods. Rules: must begin with a letter (a-z, A-Z), $, or _ can be followed by any number of letters, numbers, $, or _ spaces are not allowed cannot be the same as a keyword a word like class that is part of the language itself (see the book) Which of these are not valid identifiers? n1 avgSalary num_values course name 2n Java is case-sensitive (for both identifiers and keywords). example: HelloWorld is not the same as helloWorld Conventions for Identifiers Capitalize class names. example: HelloWorld Do not capitalize method names. example: main Capitalize internal words within the name. example: HelloWorld Printing Text public class HelloWorld { public static void main(String[] args) { System.out.println("hello, world"); } } Our program contains a single statement that prints some text. The printed text appears in a window known as the console. Printing Text (cont.) The general format of such statements is: System.out.println("<text>"); where &l...

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:

BU - CS - 105
How to Create Unix CS Account(from a Linux workstation)0. Linux workstations can be found on the le hand side (facing Comm. Ave.) of the Undergraduate Computing Lab. When you find an open terminal you will see a login screen similar to Image 1.I
BU - CS - 105
Computer Science 105: Practice Problems on ER Diagrams1.Given the portion of an ER diagram shown above, which of the following statements are true? I. R connects each entity in A to at least one entity in B II. R connects each entity in A to at m
BU - CS - 105
CS105IntroductiontoDatabases andDataAnalysisAMath/CSDivisionalStudiesCourse OfferedinFall2007Databases and other collections of data are everywhere: Retailers use data about customers and their purchases to make decisions that increase profits.
BU - CS - 111
Methods with Parameters and Return ValuesComputer Science 111 Boston University Spring 2009 David G. Sullivan, Ph.D.Review: Static Methods We've seen how we can use static methods to: 1. capture the structure of a program breaking a task into s
BU - CS - 105
SkyServer: An Astronomical DatabaseComputer Science 105 Boston University Fall 2008 David G. Sullivan, Ph.D.Sloan Digital Sky Survey (SDSS) A database of astronomical data (10s of terabytes) five-year survey mapping 1/4 of the night sky inform
BU - CS - 111
File ProcessingComputer Science 111 Boston University Spring 2009 David G. Sullivan, Ph.D.Review: Scanner Objects We've been using Scanner objects to read from the console:Scanner console = new Scanner(System.in); By passing System.in to the
BU - CS - 111
RecursionComputer Science 111 Boston University Spring 2009 David G. Sullivan, Ph.D.Review: Method Frames When you make a method call, the Java runtime sets aside a block of memory known as the frame of that method call.main number otherNumber
BU - CS - 105
Data Mining I: IntroductionComputer Science 105 Boston University Spring 2009 David G. Sullivan, Ph.D.References for This Part of the Course Roiger &amp; Geatz, Data Mining: A Tutorial-Based Primer (Addison-Wesley, 2003) Witten &amp; Frank, Data Mining
BU - CS - 105
The SQL Query LanguageComputer Science 105 Boston University Spring 2009 David G. Sullivan, Ph.D.What is a Query Language? A query language is a language that can be used to access and modify the contents of a database. SQL is the most widely u
BU - CS - 105
Case Study: Predicting Patient OutcomesComputer Science 105 Boston University Spring 2009 David G. Sullivan, Ph.D.Dataset Description The &quot;spine clinic dataset&quot; from Roiger &amp; Geatz. Data consists of records for 171 patients who had back surgery
BU - CS - 105
Programming in Python IV: Working with StringsComputer Science 105 Boston University Spring 2009 David G. Sullivan, Ph.D.Strings in Python The string data type is used to represent text data. We've already been using string literals, which cons
BU - CS - 105
Data Mining IV: Preparing the DataComputer Science 105 Boston University Spring 2009 David G. Sullivan, Ph.D.The Data Mining Process Key steps: assemble the data in the format needed for data mining typically a text file perform the data min
BU - CS - 105
Programming in Python III: Making DecisionsComputer Science 105 Boston University Spring 2009 David G. Sullivan, Ph.D.Flow of Control Flow of control = order in which instructions are executed By default, instructions are executed in sequential
BU - CS - 105
SQLiteComputer Science 105 Boston University Fall 2008 David G. Sullivan, Ph.D.What is SQLite? An open-source relational DBMS (RDBMS) we're using version 3 It can be easily downloaded and used on any common type of platform (Windows, Mac, Linu
BU - CS - 105
Programming in Python VI: Working with FilesComputer Science 105 Boston University Spring 2009 David G. Sullivan, Ph.D.Escape Sequences Recall: we can surround strings by either single or double quotes. doing so allows us to embed quotes within
BU - CS - 105
Computer Science 105 Overview of the Final ExamDate, time, and location Saturday, December 20, 12:30-2:30 p.m., GCB 204 (our usual classroom) Topics covered The exam will cover the entire semester. You do not need to know the Weka-specific details f
BU - CS - 105
Data Mining II: Classification LearningComputer Science 105 Boston University Spring 2009 David G. Sullivan, Ph.D.Weka Data-Mining Software A free, open-source data-mining tool. we'll use the &quot;book version&quot; Weka is available here: http:/www.cs
BU - CS - 105
Programming BasicsComputer Science 105 Boston University Spring 2009 David G. Sullivan, Ph.D.Beyond Relational Databases While relational databases are extremely powerful, they may be inadequate/insufficient for a given problem. Example 1: DNA
BU - CS - 111
ArraysComputer Science 111 Boston University Spring 2009 David G. Sullivan, Ph.D.Collections of Data Recall our program for averaging quiz grades:public static void main(String[] args) { Scanner console = new Scanner(System.in); int total = 0;
BU - CS - 111
Indefinite Loops and Boolean ExpressionsComputer Science 111 Boston University Spring 2009 David G. Sullivan, Ph.D.Review: Definite Loops The loops that we've seen thus far have been definite loops. we know exactly how many iterations will be p
BU - CS - 111
Procedural Decomposition(How to Use Methods to Write Better Programs)Computer Science 111 Boston University Spring 2009 David G. Sullivan, Ph.D.Example Program: Writing Block Letters Here's a program that writes the name &quot;DEE&quot; in block letters:
BU - CS - 111
Conditional ExecutionComputer Science 111 Boston University Spring 2009 David G. Sullivan, Ph.D.What is Conditional Execution? There are situations in which we want a set of instructions to be executed some of the time but not all of the time.
BU - CS - 111
Computer Science 111 Overview of the Final ExamDates, times, and locations Section A1: Friday, December 19, 3-5 p.m., CAS 224 (our usual classroom) Section B1: Saturday, December 20, 9-11 a.m., GCB 205 (our usual classroom) Topics covered The exam w
BU - CS - 111
Inheritance and PolymorphismComputer Science 111 Boston University Spring 2009 David G. Sullivan, Ph.D.A Class for Modeling an Automobilepublic class Automobile { private String make; private String model; private int year; private int mileage;
BU - CS - 330
CS330:AlgorithmTeaching Section 003 TF: Tao Wang Sept. 24, 20031Problem 4.1-6 Solve T (n) = 2T ( n) + 12Problem 4.3-1a)T (n) = 4T (n/2) + n b)T (n) = 4T (n/2) + n2 c)T (n) = 4T (n/2) + n33Permute-By-SortingPERMUTE-BY-SORTING(A) 1 n
BU - CS - 330
CS330:AlgorithmTeaching Section 001 TF: Tao Wang Sept. 9, 20031Note(0)Oce hours: PSY 226, Wed. 3-4, Thur 10-12 Email: wtwangcs.bu.edu Oce Phone#:617-358-2355 (1)Please enroll the mailing-list by $csmail -a cs330 (2)Sometimes, we will discuss t
BU - G - 1200
From - Wed May 24 18:24:15 2000Path: news.bu.edu!logbridge.uoregon.edu!news.worldonline.fr!newsfeed.adm.esc-lille.fr!news.adm.esc-lille.fr!proxad.net!oleane.net!oleane!bignews.mediaways.net!diablo.theplanet.net!europa.netcrusader.net!207.172.3.37!fe
BU - G - 1200
From - Wed Apr 26 13:55:09 2000Path: news.bu.edu!news.eecs.umich.edu!nntp-out.monmouth.com!newspeer.monmouth.com!logbridge.uoregon.edu!leto.backbone.ou.edu!news.ou.edu!not-for-mailX-Newsreader: kexpress 0.8.0MIME-Version: 1.0Content-Type: text/pl
BU - ED - 101
ED 101 Educational Technology Lab Fall 08 Boston University School of EducationLESSON PLANYour Name Supervising Darcy Teacher McSweeney Grade/School Kindergarten/Alcott Elementary School Lesson title Adventures with the Alphabet 15-30 minutes Con
BU - ED - 8588
ED 101 Educational Technology Lab Fall 08 Boston University School of EducationLESSON PLAN (Template)Your Name Grade/School Lesson title 5th Grade/ Jackson-Mann Elementary Fifth Grade Content Geometry topics Geometry area Skills 40 min. Duration
BU - LOG - 03
CS Colloquium on Wednesday, Nov. 19 at 3PMTitle: Studies on Reliable Multirate Multicast Congestion Control (PhD Thesis Proposal)Speaker: Gu-In Kwon Boston UniversityPlace: MCS 135, 111 Cummington StreetAbstract:We propose n
BU - LOG - 03
CS Colloquium on Wednesday, Nov 19 at 11AMTitle: Behavioral Authentication for Computer SecuritySpeaker: Carla E. Brodley School of Electrical and Computer Engineering Purdue UniversityMCS 135, 111 Cummington StreetAbstract:
BU - LOG - 00
! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !- B O S T O N U N I V E R S I T Y Computer Scie
BU - CS - 101
Programming Remember: programming language how to program (conceptually) programming the &quot;ROBOT&quot; computer In this lecture: programming the Pencil and Paper Computer12-1Conceptual Computers The Pencil and Paper computer is a mathematical c
BU - CS - 101
Computer Hardware (overview) Remember: The connection between boolean logic and circuits and computing boolean logic sentences can be expressed in hardware that hardware can evaluate such logic for us if the logic is useful (say, can add bits or
BU - CS - 101
Algorithms and Complexity14-1Considering Algorithms Remember: a program is the embodiment of an algorithm. Informally: The algorithm is the logic behind a program, the plan of attack to solve a problem. Formally: The algorithm is any well-defi
BU - CS - 101
Operating Systems27-1What is impact does the operating system have? So Operating Systems provide: Communications with the user Loading and executing user programs Memory Management Scheduling those programs to the CPU Communication between
BU - LX - 522
CAS LX 522 Syntax IPat must not have been sending flowers to ChrisSuppose that you were faced with the task of generating a structure for Pat must not have been sending flowers to Chris. First, assemble your numeration. What are the elements in t
BU - LX - 523
CAS LX 523 Syntax II Spring 2007February 6, 2006 Prep for week 5: The fine structure of the left peripheryRizzi, Luigi (1997). The fine structure of the left periphery. In L. Haegeman. (ed.), Elements of Grammar. Dordrecht: Kluwer. Main point: Ju
BU - LX - 502
CAS LX 502 Semantics Fall 2006 Paul HagstromOctober 15, 2006 Midterm summary/notesIntroduction, compositionality, implication, implicatures, presupposition The goal is to try to characterize how it is that we assign interpretation to sentences. W
BU - LX - 523
CAS LX 523 Syntax II Spring 2001 Paul HagstromFebruary 6, 2001 Week 4: CPSelection:The restrictions that a lexical item places on its arguments. (Usually considered a property of the complement) Verbs can select for different clause types: beli
BU - LX - 502
CAS LX 502 Semantics Spring 2003 Paul HagstromFebruary 27, 2003 Midterm summaryIntroduction, compositionality, implication, implicatures, presupposition The goal is to try to characterize how it is that we assign interpretation to sentences. We a
BU - LX - 502
Full summary of F1CAS LX 502 Semantics3b. A formalism for meaning (contd again): F2 3.2, 3.6S &quot; N VP S &quot; Neg S S &quot; S ConjP ConjP &quot; Conj S VP &quot; Vt N VP &quot; Vi N &quot; Pavarotti, Vi &quot; is boring, Vt &quot; likes Conj &quot; and, or Neg &quot; it is not[S N VP]M = t
BU - LX - 502
Truth and meaningCAS LX 5028a. Formal semantics 10.1-10.4 The basis of formal semantics: knowing themeaning of a sentence is knowing under what conditions it is true. Formal semantics, a.k.a. truth conditional semantics,a.k.a. model-theoretic
BU - LX - 522
CAS LX 522 Syntax IEpisode 5b. Agree, head movement and the strength of features 5.4Feature classes!You may recall that we at one point talked about divide features into types; nows the time it matters.!There are tense features. Like past,
BU - LX - 502
SetsCAS LX 50210a. A notational holiday A set is a collection of entities of any kind. They can be finite: {2, John Saeed, 1984}. They can be infinite: the set of integers greater than 5. We can specify a finite set by listing its members. W
BU - LX - 502
S N VP[S N VP]M = true iff [N]M [VP]M, otherwise false[S S1 Conj S 2]M = [Conj]M ( &lt; [S1]M, [S 2]M &gt; )CAS LX 5029a. Formal semantics Functions and lambda notationS S Conj S S Neg S VP Vt N VP Vi N Pavarotti, Vi is boring, Vt likes
BU - LX - 502
CAS LX 5023b. Truth and logic 4.1-4.4Desiderata for a theory of meaning A is synonymous with B A has the same meaning as B A entails B If A holds then B automatically holds A contradicts B A is inconsistent with B A presupposes B B is p
BU - LX - 502
CAS LX 502 Semantics10a. Presupposition 10.2Presupposition!Frege 1892:Referring expressions (names, definite descriptions) carry the presupposition that they do in fact refer. ! For a sentence to have a truth value, its presupposition must hol
BU - LX - 522
CAS LX 522 Syntax IEpisode 5b. Agree and movement 5.35.4The Big PictureNow that we've gotten some idea of how the system works, let's back up a bit to remind ourselves a bit about why we're doing what we're doing. People have (unconscious
BU - CS - 320
BU CAS CS 320:Concepts of Programming Languages Lecture NotesHongwei Xi Computer Science Department, Boston University 111 Cummington Street, Boston, MA 022152Chapter 1Building Abstractions with Procedures1.1 The Elements of Programming p
BU - CS - 320
Concepts of Programming LanguagesHongwei Xi Comp. Sci. Dept. Boston University1September 5, 2006Welcome!Concepts of Programming Languages is a course that introduces students to some fundamental concepts in programming language design and imp
BU - CS - 320
CS320 Programming Languages Solution Set 2Nenad Dedi c Comupter Science Department Boston UniversityExercise 1: We will prove the statement using mathematical induction. Let P (n) : N {T, F } be a predicate dened as follows (N here denotes the set
BU - CS - 320
BU CAS CS 320 (Spring Semester, 2002)Concepts of Programming Languages Assignment 6Due: Wednesday, the 3rd of April 2002Total: 210 points + up to 200 bonus points Exercise 1 (100 base points + up to 200 bonus points) Implementing a blackjack play
BU - CS - 320
BU CAS CS 320 (Spring Semester, 2002)Concepts of Programming Languages Assignment 2Out: Monday, 28 January 2002 Due: Monday, 4 February 2002Total: 120 points Exercise 1 (40 points) A Braun tree is a binary tree such that for each node the size of
BU - CS - 320
BU CAS CS 320 (Spring Semester, 2002)Concepts of Programming Languages Assignment 7Due: Wednesday, the 17th of April 2002Total: 250 points Exercise 1 (10 points) Please do Exercise 3.39 in the textbook on page 306. Exercise 2 (10 points) Please d
BU - CS - 320
BU CAS CS 320 (Spring Semester, 2002)Concepts of Programming Languages Assignment 8Due: Wednesday, the rst of May 2002Total: 300 points Exercise 1 (100 points) Please implement an interpreter for a subset of Scheme that supports the features cove
BU - CS - 320
A Crash Course on Standard MLHongwei Xi Version of November 23, 20041StartType sml-cm at a Unix window to get an interactive interpreter for Standard ML (SML). You can later quit the interpreter by typing ctrl-D.2GeneralitiesAt the promp
BU - CS - 320
BU CAS CS 320 (Spring Semester, 2002)Concepts of Programming Languages Assignment 1Out: Monday, 14 January 2002 Due: Monday, 28 January 2002Academic Integrity We pledge strict adherence to the university guidelines. All work you turn in must be
BU - CS - 320
BU CAS CS 320 (Spring Semester, 2002)Concepts of Programming Languages Assignment 4Out: Monday, 11 Feburary 2002 Due: Tuesday, 19 Feburary 2002Total: 160 points Exercise 1 (20 points) Show that we can represent pairs of natural numbers using only
BU - CS - 320
BU CAS CS 320 (Spring Semester, 2002)Concepts of Programming Languages Assignment 5Out: Tuesday, 19 Feburary 2002 Due: Friday, 1 March 2002Total: 250 points Exercise 1 (50 points) Please do Exercise 2.69 in the textbook on page 168. Exercise 2 (5