CS 100, Summer 2001 Tuesday, 6/26 Lecture 2 ----------------------------------------------------------------------- Introduction: + Collect Survey + Collect Exercise 1 Announcements: + Exercise 2 due Wednesday, 6/27 + Assignment 1 due Thursday, 6/28 + reading: Savitch 3.1, 3.2 (only while), 3.4 and Chapman (Ch. 1) + how to pick up work (post-lecture, or Carpenter) ----------------------------------------------------------------------- Topics: + CS 100 Philosophy + Algorithms + Java language concepts + demo Java/CodeWarrior + tokens + statements + variables and assignments ----------------------------------------------------------------------- Summary from lecture 1 + Welcome to CS 100 + Course procedures (requirements) + Process of programming (problem solving) + Computer languages ----------------------------------------------------------------------- CS100 philosophy: + assume NO experience - be respectful of others if you have experience! - inexperience != bad grade + some people who have experience don't do well (bad habits) + some people who've never programmed have been at the top of the class ----------------------------------------------------------------------- Your responsibilities: + reading + lecture + assignments + read newsgroup ----------------------------------------------------------------------- Process of programming: + You learn the magic incantations necessary to turn natural language into something the computer can use + Recipes! + Are you trying to bake the cake without a recipe? + Input/process/output ----------------------------------------------------------------------- Java Language concepts: + from before: comments, whitespace, identifiers + Good naming rules: 1. meaningful 2. unique - e.g., do not do String Name = "Kiri"; String nAme = "Ben"; String naMe = "Jay"; String namE = "Hongjie"; - This is legal in Java, but apt to cause confusion. Bad style. + Reserved words (sometimes called keywords) - part of the language - not available for use as identifiers (where users redefine) - ex) public, class, void - see Appendix 1 + Primitive data: - boolean, char, byte, short, int, long, float, double - we'll use boolean, char, int, double and skip the rest + Examples: - int int;? (error, reserved word) - int nStudents = 51; - double avgScore = 86.3; - char cs100Grade = 'A'; - boolean goodClass = true; + Remember: all types have finite space! Some numbers may be too big to fit. ---------------------------------------------------------------------- + Strings - collections of characters - String myName = "Kiri Wagstaff"; - string arithmetic (concatenation): - String myName = "Kiri" + "Wagstaff"; // this has no space! ---------------------------------------------------------------------- COLLECT Exercise 1, Survey Pick up as you go out: Exercise 2 (java intro)