Welcome to CS-IT 114 Introduction to Java Spring 2006 Namita Singla Department of Computer Science University of Massachusetts Boston Primary Goals • A student who successfully completes CSIT 114 should be able to: – Understand and apply Java primitive data types – Understand and apply basic java statements and control structures – Write simple Java methods that call methods of other Java objects – Be prepared for CS-IT 115 2 Secondary Goals • The theme of Spring 2006 CS-IT 114 is writing small java programs. • A student who successfully completes Spring 2006 CS-IT 114 should understand: – Java variables – Control structures – Algorithms for Image manipulation 3 CS-IT 114/5 and CS 110 • Alternative sequences for beginning Computer Science students – Both cover the same material – Both provide a strong foundation for programming and Computer Science • CS 110 – One semester course – Appropriate for students with some programming background • in any language – Prerequisite: Math 140 or placement exam • CS-IT 114 & CS-IT 115 – Two Semester Sequence – Appropriate for students with little or no programming background – Prerequisite: Math 130 or placement exam 4 Web Page • http://www.cs.umb.edu/csit114 • The source for all things CS-IT 114 – – – – – – Schedule Syllabus Homework assignments Lecture slides Contact information … • By taking this course, you acknowledge that you are reading the web site – You are responsible for knowing what is there 5 Namita Singla • Call me “Namita” • Masters in CS from IIT, Kharagpur, India • Working on Ph.D. at UMB • Third year of teaching • CS Career: – Did Bachelors and Masters in CS – Teaching in India – Working on Ph.D. in the field of Data Mining with Prof. Simovici. • Research Interests – Data Mining – Machine learning – Semantic Modeling in Databases • Contact Information – Office: S-3-133 – Office Hours • Tuesday and Thursday 2:30-3.30PM – Email singlanamita@yahoo.com – Phone: 617 287 6482 6 Teaching Assistants • TAs – TBA 7 Textbook • Textbook – JSS – fourth edition • Previous editions are not sufficient – http://duke.csc.villano va.edu/jss1/index.html 8 Other Materials • Some RW storage device (every class) 9 Room • We meet Tuesdays and Thursdays 4.005.15PM – H03-009A White Lab 10 Grades • Three components of your final grade: – Classroom work – 10% – Projects – 30% • Approximately 8 programming projects during the semester • Pairs or individual – Exams – 60% • Midterm 1 – 20% • Midterm 2 – 20 % • Final – 30% 11 Collaboration • You can work individually or in teams of 2 for every assignment. • If you work in a team of 2, each individual must submit a statement of – My role and contribution to the project – My partner’s role and contribution to the project • Each teammate will receive the same grade for the project – Unless there is a disparity in the contributions 12 Exams • Exam Grade – 60 percent of your final grade • Two exams – Midterm 1&2 – 20 percent of your final grade each – Final Exam – 20 percent of your final grade • To get a late exam, you need a documented excuse – Within 2 days after the exam • Final exams are in May 15-19, 2006 – You must be at the scheduled exam – You cannot get an earlier exam if you are traveling – Make your travel plans accordingly 13 Final Grade • Your final grade will be determined from the sum of your homework and exam grades • Passing is 60% • You also must pass the exam portion to pass the course – You need at least 60% of the total exam points • If P is your percent grade, your letter grade will be: P ≥ 93 A 90 <= P < 93 A- 87 <= P < 90 B+ 83 <= P < 87 B 80 <= P < 83 B- 77 <= P < 80 C+ 73 <= P < 77 C 70 <= P < 73 C- 67 <= P < 70 D+ 63 <= P < 67 D 60 <= P < 63 D- P < 60 F 14 Honesty • Cheaters will be caught – All assignments are to follow collaboration guidelines – All exams are to be your own work • Zero-tolerance policy for cheating – You cheat – you fail the course – No second chances • See the code of student conduct – http://www.umb.edu/student_services/student_rights/code_conduct.html 15 Acknowledging Sources • You must acknowledge any source that provided intellectual content to your assignment – You then must explain your contribution • Example: – I used code from http://chayden.net/eliza/Eliza/ in creating my artificial psychiatrist program. I added functionality to react in ways a CS student would understand, such as “how long have you felt this special bond between you and the operating system?” 16 Withdrawals and Incompletes • Dates – Add/Drop ends • January 30, 2006 – Withdrawal Deadline • April 6, 2006 – Pass/Fail Deadline • April 6, 2006 • Note: You can only get an incomplete if you are passing the course and cannot complete the course – Not if you are failing and want to take the course again 17 Students with Disabilities • If you have a documented disability and need adaptation: – Contact Ross Center for Disability Services • Campus Center 2nd Floor Room 2010 • 617 287 7430 – Obtain an adaptation recommendation – See me to discuss the recommendation – Best before the drop/add date 18 Getting Extra Help • The Math Resource Center offers tutoring – 30 Minute Sessions – Schedule TBA – By appointment only – Student Center, 1300 Street, Room 401 – Call 617-287-6486 19 Learning to program • • • • • Lots of fun Practical Hard, time consuming Exercise in reading, writing, thinking Key is practice 20 Teaching/learning style • To learn a language well, live in a land where it’s spoken – anxiety producing, but efficient! • Learn to write by reading and writing about what you learn • 60% of a lot is more than 100% of a little • Ask questions (to slow me down) 21 Why Java? • Fashionable, modern (for good reasons) • Object oriented: when you have designed the architecture a program almost writes itself • Portable: the same Java code can run on any computer. • Well designed: – easy to learn – hard to make serious mistakes – prebuilt objects plug into your programs 22 Types of Software (Programs) • Computers are very powerful pieces of hardware that can’t do much useful work until they are properly programmed • There are three different types of software: – Operating Systems – Application Programs – Software Development Tools (or Kits) • As a computer programmer, you may need to write any or all three types of programs 23 Operating System Programs • “O/S” programs control the hardware and allow application programs to be executed • An O/S is usually built to run on a specific underlying hardware platform. • Generally these are the most complex types of programs to write and test • Examples: – M/S DOS, Windows, UNIX, Linux, Solaris, etc. 24 Application Programs • “Apps” perform useful work for their users • Apps are usually built to run on a specific operating system (and specific underlying hardware platform) • Users typically need to provide a lot of information about their job tasks for a programmer to write a good application program for that purpose • Examples: – Word, Excel, PowerPoint, Netscape, etc. 25 Software Development Tools • Software Development Tools or Kits (SDK’s) are specialized application programs that allow programmers to write and test programs • Experienced programmers generally prefer an “Integrated Development Environment” (IDE) • Examples (that we’ll be using in this course): – Sun’s Java SDK (sometimes called JDK) – Dr Java IDE 26 Styles of User Interface • There are two predominant styles of User Interface for any type of program: – Command Line Interface (CLI) – Graphical User Interface (GUI) • As a computer programmer, you must be able to use and write programs for both styles of user interface 27 Software Development Tools • Using Sun Java SDK alone Command Line Interface Programmer Editor Source File(s) (.java) Compiler (javac) Class File(s) (.class) Virtual Machine (java) Program executes Parts of Sun Java SDK 28 Using Sun Java SDK Alone • Example DOS Commands and Parameters C:\ > edit HelloWorld.java (Create/edit “source file” in an external window) C:\ > javac HelloWorld.java (creates .class file) C:\ > java -classpath … HelloWorld Hello World C:\ > exit 29 Software Development Tools • We will use a combination of the Dr Java IDE and the Sun Java SDK Graphical User Interface Dr Java IDE Edit Build Run Source File(s) (.java) Compiler (javac) Programmer Class File(s) (.class) Virtual Machine (java) Program executes Parts of Sun Java SDK 30 Program Development Steps • Classical “Waterfall” Development Steps Edit and save source code Errors Build source code to create program Errors Run program and evaluate results 31 Errors • A program can have three types of errors: • The IDE editor and/or compiler will find syntax errors and other basic problems (compile-time errors) – If compile-time errors exist, an executable version of the program is not created • A problem can occur during program execution, such as trying to divide by zero, which causes a program to terminate abnormally (run-time errors) • A program may run, but produce incorrect results, perhaps using an incorrect formula (logical errors) Georgia Institute of Technology 32