} Each object in a Java program has an identifier (name) } This includes:
|
|
- Maurice Pearson
- 5 years ago
- Views:
Transcription
1 Class #05: More about Objects and Methods Software Design I (CS 120): M. Allen, 11 Sept Important Java Syntax I: Identifiers Each object in a Java program has an identifier (name) This includes: any class, like DrawingGizmo any variable, like pen or pencil any method, like moveforward() anything else Each identifier in a Java program: will contain one or more alphanumeric characters: a z, A Z, 0 9 can also contain the underscore or dollar symbol: _, $ must not begin with a number (e.g., a3 is legal, but 3a is not) Other rules: Names must be unique within same scope This means that, inside any block defined by brackets, we cannot have two different elements with the same identifier Names are case sensitive Names should be meaningful Tuesday, 11 Sep Software Design I (CS 120) 2 Important Java Syntax, II: Classes Important Java Syntax, III: main() Every working Java program must define at least one class of object. Here, our program begins by defining the Driver class. We choose this name, so it could be called something else, like Program, or PictureMaker, or whatever we like, as long as it is not some name that already exists. For instance, we cannot call it DrawingGizmo, since that is the name that already belongs to another piece of code we are using in this program. The format of the class definition we will use in most cases is: public class ClassName Every working Java program must begin with a special method called main(), that always looks exactly the same on its first line. This method uses constructors like DrawingGizmo() to actually create all the other objects we need and run their methods for us. Tuesday, 11 Sep Software Design I (CS 120) 3 Tuesday, 11 Sep Software Design I (CS 120) 4 1
2 How Does main() Work? Important Java Syntax, IV The main() method that runs everything has a complex form: public static void main( String[] args ) Over the semester, we will learn what this all means! Every complete block of code must be enclosed by braces Blocks include things like a class or a complete method like main() here. Every complete line of code must end with a semi-colon. Tuesday, 11 Sep Software Design I (CS 120) 5 Tuesday, 11 Sep Software Design I (CS 120) 6 Important Java Syntax, V These are Javadoc comments. Start at opening marker (/**) and end at close (*/). Usually appear right before methods, to explain their operation. Each method you write should have at least one line of these kind of comments. Java Coding Style The name of a class, like Driver or DrawingGizmo, should start with a Capital Letter. The name of a variable, like pencil, or a method, like main() or moveforward(), should start with a lower-case letter. Java allows us to place comments in code. Completely ignored by the computer, and are meant only for ourselves and other programmers to read. These are inline comments. Each line must start with the comment marker (//). Generally used inside body of a class or method (and should be used relatively little except in highly complex code). For multi-word names, we use capitals or underscore symbols, or both, to separate words: multiplewordmethodname() multiple_word_method_name() ComplexClassName Complex_Class_Name Tuesday, 11 Sep Software Design I (CS 120) 7 Tuesday, 11 Sep Software Design I (CS 120) 8 2
3 Class Specifications A class diagram only gives a sketch of that class More detail is given by the full specification of a class Every useful Java class should have such a specification When you write code, it s up to you to create this document, so others can make proper use of your code The DrawingGizmo Specification The invariants give us the basic details about the objects, in terms of properties that must always hold: Invariants A DrawingGizmo object appears appears as an arrow within a window entitled Drawing Canvas, and is either in drawing mode (in which case it is green) or moving mode (in which case it is red). Two main parts: 1. Invariants: things that are always true of class objects 2. Methods: all the operations involving the class, with: Pre-conditions: Anything that needs to be true before the method will work properly Post-conditions: Anything that will be true after the method is done Tuesday, 11 Sep Software Design I (CS 120) 9 Tuesday, 11 Sep Software Design I (CS 120) 10 Basic Methods Update Methods public void draw() post: The DrawingGizmo is set to drawing mode (and is colored green). public void dontdraw() post: The DrawingGizmo is set to moving mode (and is colored red). public void turnclockwise() post: The DrawingGizmo is rotated 30 degrees clockwise from its current heading. public void turncounterclockwise() post: The DrawingGizmo is rotated 30 degrees counterclockwise from its current heading. Some methods have post-conditions only Nothing special is required for them to work Only need DrawingGizmo object instance to call them Tuesday, 11 Sep Software Design I (CS 120) 11 Methods with Both Pre- and Post-conditions public void moveforward() pre: The DrawingGizmo should be at least 20 pixels from the edge of the screen towards which it is pointing; if it is not, then the object and part of the line it draws will appear o -screen. post: TheDrawingGizmo moves in the direction of its arrow by 20 pixels. If it is is drawing mode, a line segment will be drawn between its current and prior position. The preconditions on the moveforward() method tell us what must be true before the method can properly run. (If these are not satisfied, then the method may not necessarily work properly, or even work at all.) The postconditions tell us what will be true after the method has finished running properly. Tuesday, 11 Sep Software Design I (CS 120) 12 3
4 More Complex Methods DrawingGizmo object has simple methods, each of which does the same thing, the same way, every time But it also has some more complex methods, which: Take input parameters Change what they do based on those parameters DrawingGizmo <<constructor>> DrawingGizmo() <<update>> void moveforward() void turnclockwise() void turncounterclockwise() void dontdraw() void draw() void turnby( int ) void moveby( int ) void delayby( int ) A Parameterized Method public void turnby( int n ) post: This object is rotated n degrees clockwise from its previous direction. The turnby( int ) method wants us to insert an integer value ( int in Java) as an input parameter We must give it an integer when we call it, or it won t work! pen.turnby( 9000 ); pen.turnby( -180 ); pen.turnby( 3.6 ); pen.turnby(); All of these are OK. These are both wrong. Tuesday, 11 Sep Software Design I (CS 120) 13 Tuesday, 11 Sep Software Design I (CS 120) 14 Parameterized Methods vs. Non-parameterized Methods The parentheses () in a method specification serve two purposes: 1. They indicate that it is a method, so compiler and coder know what it is 2. They show whether or not the method has any input parameters If the method is not parameterized, then nothing is shown in the parentheses, and when we use it, we cannot put anything there, or our code won t compile Similarly, if the method is parameterized, then we have to put actual parameters into the code when we use it In this description, the diagram shows the type of the input parameter It is up to us to actually choose what particular input value we will put in there when we call the method DrawingGizmo <<constructor>> DrawingGizmo() <<update>> void moveforward() void turnclockwise() void turncounterclockwise() void dontdraw() void draw() void turnby( int ) void moveby( int ) void delayby( int ) Two More Parameterized Methods public void setbackground( java.awt.color ) public void setforeground( java.awt.color ) These new DrawingGizmo methods change the color of the background window and drawing line E.g., for a yellow line on a blue background: pen.setbackground( java.awt.color.blue ); pen.setforeground( java.awt.color.yellow ); Tuesday, 11 Sep Software Design I (CS 120) 15 Tuesday, 11 Sep Software Design I (CS 120) 16 4
5 The Java Color Class Address java.awt.color.green library group library package class class member Supported Colors java.awt.color.black java.awt.color.blue java.awt.color.cyan java.awt.color.darkgray java.awt.color.gray java.awt.color.green java.awt.color.lightgray java.awt.color.magenta java.awt.color.orange java.awt.color.pink java.awt.color.red java.awt.color.white java.awt.color.yellow Tuesday, 11 Sep Software Design I (CS 120) 17 Using Import Statements Instead Rather than write the entire Color address each time, we can import the Color class, using information found in the list of standard Java classes Inside the Color class specification, we find the library path for importing: Class package and name One or more lines of a class hierarchy The last line gives the path we need to import and use the class Tuesday, 11 Sep Software Design I (CS 120) 18 public class Driver public static void main( String[] args ) DrawingGizmo pen; pen = new DrawingGizmo(); Using the Imported Code pen.setbackground( java.awt.color.blue ); pen.setforeground( java.awt.color.yellow ); import java.awt.color; public class Driver public static void main( String[] args ) DrawingGizmo pen; pen = new DrawingGizmo(); This adds the import command to the class, and now we don t have to use the full address for our colors These programs produce exactly the same result on-screen when they run Tuesday, 11 Sep Software Design I (CS 120) 19 pen.setbackground( Color.blue ); pen.setforeground( Color.yellow ); What About the DrawingGizmo? If we want to use built-in Java classes like Color, we need to either refer to their full class address or import For classes that aren t built in to the language, there is another simple option: put all the class files into the same source directory (folder) When we run our program, the JVM will allow us to use any class of object that we address, import, or that it can find along-side the source code for the main() method Tuesday, 11 Sep Software Design I (CS 120) 20 5
6 For This Week Meetings this week: Tuesday Thursday: regular classroom Friday: in the CS Lab (16 Wing) Homework 01: Colonel Sanders image Friday, 14 Sept., 5:00 PM, D2L Reading assignment: Chapters 1 2, due today Chapter 3, sections 1 9: Next Tuesday, 18 Sept. (start of day) Quiz 01: Covers lectures (all will be on Notes page) Tuesday, 18 Sept. (end of class) Office Hours: Wing 210 Monday/Wednesday/Friday, 12:00 PM 1:00 PM Tuesday/Thursday, 1:30 PM 3:00 PM Tuesday, 11 Sep Software Design I (CS 120) 21 6
Review: Using Imported Code. What About the DrawingGizmo? Review: Classes and Object Instances. DrawingGizmo pencil; pencil = new DrawingGizmo();
Review: Using Imported Code Class #06: Objects, Memory, & Program Traces Software Engineering I (CS 120): M. Allen, 30 Jan. 2018 ; = new ();.setbackground( java.awt.color.blue );.setforeground( java.awt.color.yellow
More informationTwo Types of Types. Primitive Types in Java. Using Primitive Variables. Class #07: Java Primitives. Integer types.
Class #07: Java Primitives Software Design I (CS 120): M. Allen, 13 Sep. 2018 Two Types of Types So far, we have mainly been dealing with objects, like DrawingGizmo, Window, Triangle, that are: 1. Specified
More informationAnnouncements - Grades UBLearns grades just updated Monday, March 28 th (11:00am). Please check grades.
CSE 113 A March 28 April 1, 2011 Announcements - Grades UBLearns grades just updated Monday, March 28 th (11:00am). Please check grades. If an EXAM grade is incorrect, you need to bring the exam to me
More information} Evaluate the following expressions: 1. int x = 5 / 2 + 2; 2. int x = / 2; 3. int x = 5 / ; 4. double x = 5 / 2.
Class #10: Understanding Primitives and Assignments Software Design I (CS 120): M. Allen, 19 Sep. 18 Java Arithmetic } Evaluate the following expressions: 1. int x = 5 / 2 + 2; 2. int x = 2 + 5 / 2; 3.
More informationReview: Classes and Object Instances. Review: Creating an Object. Using Multiple Objects. DrawingGizmo pencil; pencil = new DrawingGizmo();
Review: Classes and Object Instances ; = new (); Class #05: Objects, Memory, & Program Traces Software Engineering I (CS 120): M. Allen, 12/13 Sept. 17 We are working with both a class () and an object
More informationCS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG
CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG 1 Notice Reading Assignment Chapter 1: Introduction to Java Programming Homework 1 It is due this coming Sunday
More informationBasic Class Diagrams. Class Diagrams, cont d. Class Diagrams, cont d. Car. Car. Car. What does the minus sign here mean?
Class #02: Inheritance and Object-Oriented Design Software Design II (CS 220): M. Allen, 23 Jan. 18 Basic Class Diagrams Describes a class and how it can be used properly Sketch of properties and behaviors
More informationReview: Object Diagrams for Inheritance. Type Conformance. Inheritance Structures. Car. Vehicle. Truck. Vehicle. conforms to Object
Review: Diagrams for Inheritance - String makemodel - int mileage + (String, int) Class #3: Inheritance & Polymorphism Software Design II (CS 220): M. Allen, 25 Jan. 18 + (String, int) + void
More informationLecture 02, Fall 2018 Friday September 7
Anatomy of a class Oliver W. Layton CS231: Data Structures and Algorithms Lecture 02, Fall 2018 Friday September 7 Follow-up Python is also cross-platform. What s the advantage of Java? It s true: Python
More informationSearching for Information. A Simple Method for Searching. Simple Searching. Class #21: Searching/Sorting I
Class #21: Searching/Sorting I Software Design II (CS 220): M. Allen, 26 Feb. 18 Searching for Information Many applications involve finding pieces of information Finding a book in a library or store catalogue
More informationCS Problem Solving and Object-Oriented Programming
CS 101 - Problem Solving and Object-Oriented Programming Lab 5 - Draw a Penguin Due: October 28/29 Pre-lab Preparation Before coming to lab, you are expected to have: Read Bruce chapters 1-3 Introduction
More informationCreating objects TOPIC 3 INTRODUCTION TO PROGRAMMING. Making things to program with.
1 Outline TOPIC 3 INTRODUCTION TO PROGRAMMING Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared
More informationCS 201 Advanced Object-Oriented Programming Lab 6 - Sudoku, Part 2 Due: March 10/11, 11:30 PM
CS 201 Advanced Object-Oriented Programming Lab 6 - Sudoku, Part 2 Due: March 10/11, 11:30 PM Introduction to the Assignment In this lab, you will finish the program to allow a user to solve Sudoku puzzles.
More informationOutline. Turtles. Creating objects. Turtles. Turtles in Java 1/27/2011 TOPIC 3 INTRODUCTION TO PROGRAMMING. Making things to program with.
1 Outline 2 TOPIC 3 INTRODUCTION TO PROGRAMMING Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared
More informationUsing System.out.println()
Programming Assignments Read instructions carefully Many deduction on Program 3 for items in instructions Comment your code Coding conventions 20% of program grade going forward Class #23: Characters,
More information+! Today. Lecture 3: ArrayList & Standard Java Graphics 1/26/14! n Reading. n Objectives. n Reminders. n Standard Java Graphics (on course webpage)
+! Lecture 3: ArrayList & Standard Java Graphics +! Today n Reading n Standard Java Graphics (on course webpage) n Objectives n Review for this week s lab and homework assignment n Miscellanea (Random,
More informationLecture 2. COMP1406/1006 (the Java course) Fall M. Jason Hinek Carleton University
Lecture 2 COMP1406/1006 (the Java course) Fall 2013 M. Jason Hinek Carleton University today s agenda a quick look back (last Thursday) assignment 0 is posted and is due this Friday at 2pm Java compiling
More informationIntroduction to C++ General Rules, Conventions and Styles CS 16: Solving Problems with Computers I Lecture #2
Introduction to C++ General Rules, Conventions and Styles CS 16: Solving Problems with Computers I Lecture #2 Ziad Matni Dept. of Computer Science, UCSB Administrative This class is currently FULL and
More informationLecture Programming in C++ PART 1. By Assistant Professor Dr. Ali Kattan
Lecture 08-1 Programming in C++ PART 1 By Assistant Professor Dr. Ali Kattan 1 The Conditional Operator The conditional operator is similar to the if..else statement but has a shorter format. This is useful
More informationCS 231 Data Structures and Algorithms, Fall 2016
CS 231 Data Structures and Algorithms, Fall 2016 Dr. Bruce A. Maxwell Department of Computer Science Colby College Course Description Focuses on the common structures used to store data and the standard
More informationCISC-124. Dog.java looks like this. I have added some explanatory comments in the code, and more explanation after the code listing.
CISC-124 20180115 20180116 20180118 We continued our introductory exploration of Java and object-oriented programming by looking at a program that uses two classes. We created a Java file Dog.java and
More informationChapter 4 Defining Classes I
Chapter 4 Defining Classes I This chapter introduces the idea that students can create their own classes and therefore their own objects. Introduced is the idea of methods and instance variables as the
More informationBasics of Java Programming
Basics of Java Programming Lecture 2 COP 3252 Summer 2017 May 16, 2017 Components of a Java Program statements - A statement is some action or sequence of actions, given as a command in code. A statement
More informationProgramming Assignment 1: CS11TurtleGraphics
Programming Assignment 1: CS11TurtleGraphics Due: 11:59pm, Thursday, October 5 Overview You will use simple turtle graphics to create a three-line drawing consisting of the following text, where XXX should
More informationCS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM
CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM Objectives Defining a wellformed method to check class invariants Using assert statements to check preconditions,
More informationCS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 8: SEP. 29TH INSTRUCTOR: JIAYIN WANG
CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 8: SEP. 29TH INSTRUCTOR: JIAYIN WANG 1 Notice Prepare the Weekly Quiz The weekly quiz is for the knowledge we learned in the previous week (both the
More informationSoftware and Programming 1
Software and Programming 1 Lab 1: Introduction, HelloWorld Program and use of the Debugger 17 January 2019 SP1-Lab1-2018-19.pptx Tobi Brodie (tobi@dcs.bbk.ac.uk) 1 Module Information Lectures: Afternoon
More informationCOMP-202: Foundations of Programming. Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2015
COMP-202: Foundations of Programming Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2015 Assignment Due Date Assignment 1 is now due on Tuesday, Jan 20 th, 11:59pm. Quiz 1 is
More informationProgramming In Java Prof. Debasis Samanta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur
Programming In Java Prof. Debasis Samanta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 06 Demonstration II So, in the last lecture, we have learned
More informationBinghamton University. CS-211 Fall Syntax. What the Compiler needs to understand your program
Syntax What the Compiler needs to understand your program 1 Pre-Processing Any line that starts with # is a pre-processor directive Pre-processor consumes that entire line Possibly replacing it with other
More informationAdministration. Classes. Objects Part II. Agenda. Review: Object References. Object Aliases. CS 99 Summer 2000 Michael Clarkson Lecture 7
Administration Classes CS 99 Summer 2000 Michael Clarkson Lecture 7 Lab 7 due tomorrow Question: Lab 6.equals( SquareRoot )? Lab 8 posted today Prelim 2 in six days! Covers two weeks of material: lectures
More informationLecture 05 I/O statements Printf, Scanf Simple statements, Compound statements
Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 05 I/O statements Printf, Scanf Simple
More informationBASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I
BASIC COMPUTATION x public static void main(string [] args) Fundamentals of Computer Science I Outline Using Eclipse Data Types Variables Primitive and Class Data Types Expressions Declaration Assignment
More informationComputer Science II Lecture 1 Introduction and Background
Computer Science II Lecture 1 Introduction and Background Discussion of Syllabus Instructor, TAs, office hours Course web site, http://www.cs.rpi.edu/courses/fall04/cs2, will be up soon Course emphasis,
More informationSoftware and Programming 1
Software and Programming 1 Lab 1: Introduction, HelloWorld Program and use of the Debugger 11 January 2018 SP1-Lab1-2017-18.pptx Tobi Brodie (tobi@dcs.bbk.ac.uk) 1 Module Information Lectures: Afternoon
More informationCS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG
CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG 1 Notice Class Website http://www.cs.umb.edu/~jane/cs114/ Reading Assignment Chapter 1: Introduction to Java Programming
More informationGRAPHICS & INTERACTIVE PROGRAMMING. Lecture 1 Introduction to Processing
BRIDGES TO COMPUTING General Information: This document was created for use in the "Bridges to Computing" project of Brooklyn College. This work is licensed under the Creative Commons Attribution-ShareAlike
More informationProgramming with Java
Programming with Java Data Types & Input Statement Lecture 04 First stage Software Engineering Dep. Saman M. Omer 2017-2018 Objectives q By the end of this lecture you should be able to : ü Know rules
More informationInitial Coding Guidelines
Initial Coding Guidelines ITK 168 (Lim) This handout specifies coding guidelines for programs in ITK 168. You are expected to follow these guidelines precisely for all lecture programs, and for lab programs.
More informationACORN.COM CS 1110 SPRING 2012: ASSIGNMENT A1
ACORN.COM CS 1110 SPRING 2012: ASSIGNMENT A1 Due to CMS by Tuesday, February 14. Social networking has caused a return of the dot-com madness. You want in on the easy money, so you have decided to make
More informationPractice Midterm 1. Problem Points Score TOTAL 50
CS 120 Software Design I Spring 2019 Practice Midterm 1 University of Wisconsin - La Crosse February 25 NAME: Do not turn the page until instructed to do so. This booklet contains 10 pages including the
More informationJava Identifiers, Data Types & Variables
Java Identifiers, Data Types & Variables 1. Java Identifiers: Identifiers are name given to a class, variable or a method. public class TestingShastra { //TestingShastra is an identifier for class char
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 informationEnumerated Types. CSE 114, Computer Science 1 Stony Brook University
Enumerated Types CSE 114, Computer Science 1 Stony Brook University http://www.cs.stonybrook.edu/~cse114 1 Enumerated Types An enumerated type defines a list of enumerated values Each value is an identifier
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 informationG52CPP C++ Programming Lecture 9
G52CPP C++ Programming Lecture 9 Dr Jason Atkin http://www.cs.nott.ac.uk/~jaa/cpp/ g52cpp.html 1 Last lecture const Constants, including pointers The C pre-processor And macros Compiling and linking And
More informationCOSC 123 Computer Creativity. Introduction to Java. Dr. Ramon Lawrence University of British Columbia Okanagan
COSC 123 Computer Creativity Introduction to Java Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Key Points 1) Introduce Java, a general-purpose programming language,
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 informationNotes from the Boards Set # 5 Page
1 Yes, this stuff is on the exam. Know it well. Read this before class and bring your questions to class. Starting today, we can no longer write our code as a list of function calls and variable declarations
More informationWrite for your audience
Comments Write for your audience Program documentation is for programmers, not end users There are two groups of programmers, and they need different kinds of documentation Some programmers need to use
More informationProgramming in Java Prof. Debasis Samanta Department of Computer Science Engineering Indian Institute of Technology, Kharagpur
Programming in Java Prof. Debasis Samanta Department of Computer Science Engineering Indian Institute of Technology, Kharagpur Lecture 04 Demonstration 1 So, we have learned about how to run Java programs
More informationCS 1110, LAB 10: ASSERTIONS AND WHILE-LOOPS 1. Preliminaries
CS 0, LAB 0: ASSERTIONS AND WHILE-LOOPS http://www.cs.cornell.edu/courses/cs0/20sp/labs/lab0.pdf. Preliminaries This lab gives you practice with writing loops using invariant-based reasoning. Invariants
More informationAP Computer Science A Summer Assignment 2017
AP Computer Science A Summer Assignment 2017 The objective of this summer assignment is to ensure that each student has the ability to compile and run code on a computer system at home. We will be doing
More informationMidterms Save the Dates!
University of British Columbia CPSC 111, Intro to Computation Alan J. Hu (Using the Scanner and String Classes) Anatomy of a Java Program Readings This Week s Reading: Ch 3.1-3.8 (Major conceptual jump
More informationPREPARING FOR PRELIM 1
PREPARING FOR PRELIM 1 CS 1110: FALL 2012 This handout explains what you have to know for the first prelim. There will be a review session with detailed examples to help you study. To prepare for the prelim,
More informationSoftware Design and Analysis for Engineers
Software Design and Analysis for Engineers by Dr. Lesley Shannon Email: lshannon@ensc.sfu.ca Course Website: http://www.ensc.sfu.ca/~lshannon/courses/ensc251 Simon Fraser University Slide Set: 2 Date:
More informationObjectives. Problem Solving. Introduction. An overview of object-oriented concepts. Programming and programming languages An introduction to Java
Introduction Objectives An overview of object-oriented concepts. Programming and programming languages An introduction to Java 1-2 Problem Solving The purpose of writing a program is to solve a problem
More informationCS 2110 Fall Instructions. 1 Installing the code. Homework 4 Paint Program. 0.1 Grading, Partners, Academic Integrity, Help
CS 2110 Fall 2012 Homework 4 Paint Program Due: Wednesday, 12 November, 11:59PM In this assignment, you will write parts of a simple paint program. Some of the functionality you will implement is: 1. Freehand
More informationQuizzes Returned. Next two weeks: Transformations 2/14/2018. Warmup 2/(# of chambers in the human Created by Mr. Lischwe.
Warmup 2/(# of chambers in the human reated by Mr. Lischwe heart 3 + 2) efore starting the warmup, get 1 sheet of tracing paper from the supply table (DO NOT draw on this) Inside your desk should be: graphing
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 informationCISC 1600 Lecture 3.1 Introduction to Processing
CISC 1600 Lecture 3.1 Introduction to Processing Topics: Example sketches Drawing functions in Processing Colors in Processing General Processing syntax Processing is for sketching Designed to allow artists
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 informationJava Bytecode (binary file)
Java is Compiled Unlike Python, which is an interpreted langauge, Java code is compiled. In Java, a compiler reads in a Java source file (the code that we write), and it translates that code into bytecode.
More informationCompSci 125 Lecture 02
Assignments CompSci 125 Lecture 02 Java and Java Programming with Eclipse! Homework:! http://coen.boisestate.edu/jconrad/compsci-125-homework! hw1 due Jan 28 (MW), 29 (TuTh)! Programming:! http://coen.boisestate.edu/jconrad/cs125-programming-assignments!
More informationAnnouncements. 1. Forms to return today after class:
Announcements Handouts (3) to pick up 1. Forms to return today after class: Pretest (take during class later) Laptop information form (fill out during class later) Academic honesty form (must sign) 2.
More informationPrinciples of Compiler Design Prof. Y. N. Srikant Department of Computer Science and Automation Indian Institute of Science, Bangalore
(Refer Slide Time: 00:20) Principles of Compiler Design Prof. Y. N. Srikant Department of Computer Science and Automation Indian Institute of Science, Bangalore Lecture - 4 Lexical Analysis-Part-3 Welcome
More informationComputer Science & Information Technology (CS) Rank under AIR 100. Examination Oriented Theory, Practice Set Key concepts, Analysis & Summary
GATE- 2016-17 Postal Correspondence 1 C-Programming Computer Science & Information Technology (CS) 20 Rank under AIR 100 Postal Correspondence Examination Oriented Theory, Practice Set Key concepts, Analysis
More informationCSE 142 Su 04 Computer Programming 1 - Java. Objects
Objects Objects have state and behavior. State is maintained in instance variables which live as long as the object does. Behavior is implemented in methods, which can be called by other objects to request
More informationLab # 2. For today s lab:
1 ITI 1120 Lab # 2 Contributors: G. Arbez, M. Eid, D. Inkpen, A. Williams, D. Amyot 1 For today s lab: Go the course webpage Follow the links to the lab notes for Lab 2. Save all the java programs you
More informationCSCI-1200 Data Structures Fall 2018 Lecture 5 Pointers, Arrays, & Pointer Arithmetic
CSCI-1200 Data Structures Fall 2018 Lecture 5 Pointers, Arrays, & Pointer Arithmetic Announcements: Test 1 Information Test 1 will be held Thursday, Sept 20th, 2018 from 6-7:50pm Students will be randomly
More informationCS 101: Computer Programming and Utilization. Abhiram Ranade
CS 101: Computer Programming and Utilization Abhiram Ranade CS 101: Computer Programming and Utilization Abhiram Ranade Course Overview How to represent problems on a computer and solve them Programming
More informationLab 12: Lijnenspel revisited
CMSC160 Intro to Algorithmic Design Blaheta Lab 12: Lijnenspel revisited 16 April 2015 Today s lab will revisit and rework the Lijnenspel game code from Lab 7, possibly using my version as a starting point.
More informationAdministration. Exceptions. Leftovers. Agenda. When Things Go Wrong. Handling Errors. CS 99 Summer 2000 Michael Clarkson Lecture 11
Administration Exceptions CS 99 Summer 2000 Michael Clarkson Lecture 11 Lab 10 due tomorrow No lab tomorrow Work on final projects Remaining office hours Rick: today 2-3 Michael: Thursday 10-noon, Monday
More informationProgramming with Arrays Intro to Pointers CS 16: Solving Problems with Computers I Lecture #11
Programming with Arrays Intro to Pointers CS 16: Solving Problems with Computers I Lecture #11 Ziad Matni Dept. of Computer Science, UCSB Thursday, 5/17 in this classroom Starts at 2:00 PM **SHARP** Please
More informationTopic Notes: Java and Objectdraw Basics
Computer Science 120 Introduction to Programming Siena College Spring 2011 Topic Notes: Java and Objectdraw Basics Event-Driven Programming in Java A program expresses an algorithm in a form understandable
More informationLecture 7. Log into Linux New documents posted to course webpage
Lecture 7 Log into Linux New documents posted to course webpage Coding style guideline; part of project grade is following this Homework 4, due on Monday; this is a written assignment Project 1, due next
More informationLecture (01) Getting started. Dr. Ahmed ElShafee
Lecture (01) Getting started Dr. Ahmed ElShafee 1 Dr. Ahmed ElShafee, fundamentals of Programming I, Agenda Download and Installation Java How things work NetBeans Comments Structure of the program Writing
More informationBLM2031 Structured Programming. Zeyneb KURT
BLM2031 Structured Programming Zeyneb KURT 1 Contact Contact info office : D-219 e-mail zeynebkurt@gmail.com, zeyneb@ce.yildiz.edu.tr When to contact e-mail first, take an appointment What to expect help
More information1 Getting started with Processing
cis3.5, spring 2009, lab II.1 / prof sklar. 1 Getting started with Processing Processing is a sketch programming tool designed for use by non-technical people (e.g., artists, designers, musicians). For
More informationBasic Data Types and Operators CS 8: Introduction to Computer Science, Winter 2019 Lecture #2
Basic Data Types and Operators CS 8: Introduction to Computer Science, Winter 2019 Lecture #2 Ziad Matni, Ph.D. Dept. of Computer Science, UCSB Your Instructor Your instructor: Ziad Matni, Ph.D(zee-ahd
More informationLab 1: Setup 12:00 PM, Sep 10, 2017
CS17 Integrated Introduction to Computer Science Hughes Lab 1: Setup 12:00 PM, Sep 10, 2017 Contents 1 Your friendly lab TAs 1 2 Pair programming 1 3 Welcome to lab 2 4 The file system 2 5 Intro to terminal
More informationMore Flow Control Functions in C++ CS 16: Solving Problems with Computers I Lecture #4
More Flow Control Functions in C++ CS 16: Solving Problems with Computers I Lecture #4 Ziad Matni Dept. of Computer Science, UCSB Administrative CHANGED T.A. OFFICE/OPEN LAB HOURS! Thursday, 10 AM 12 PM
More informationCS11 Java. Fall Lecture 1
CS11 Java Fall 2006-2007 Lecture 1 Welcome! 8 Lectures Slides posted on CS11 website http://www.cs.caltech.edu/courses/cs11 7-8 Lab Assignments Made available on Mondays Due one week later Monday, 12 noon
More informationclass objects instances Fields Constructors Methods static
Class Structure Classes A class describes a set of objects The objects are called instances of the class A class describes: Fields (instance variables)that hold the data for each object Constructors that
More informationIntroduction to Java. Java Programs Classes, Methods, and Statements Comments Strings Escape Sequences Identifiers Keywords
Introduction to Java Java Programs Classes, Methods, and Statements Comments Strings Escape Sequences Identifiers Keywords Program Errors Syntax Runtime Logic Procedural Decomposition Methods Flow of Control
More informationQUIZ How do we implement run-time constants and. compile-time constants inside classes?
QUIZ How do we implement run-time constants and compile-time constants inside classes? Compile-time constants in classes The static keyword inside a class means there s only one instance, regardless of
More informationCOMP-202: Foundations of Programming. Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2016
COMP-202: Foundations of Programming Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2016 Learn about cutting-edge research over lunch with cool profs January 18-22, 2015 11:30
More informationCIS220 In Class/Lab 1: Due Sunday night at midnight. Submit all files through Canvas (25 pts)
CIS220 In Class/Lab 1: Due Sunday night at midnight. Submit all files through Canvas (25 pts) Problem 0: Install Eclipse + CDT (or, as an alternative, Netbeans). Follow the instructions on my web site.
More informationProgramming Practice (vs Principles)
Programming Practice (vs Principles) Programming in any language involves syntax (with rules, parentheses, etc) as well as format (layout, spacing, style, etc). Syntax is usually very strict, and any small
More informationCpSc 1111 Lab 4 Part a Flow Control, Branching, and Formatting
CpSc 1111 Lab 4 Part a Flow Control, Branching, and Formatting Your factors.c and multtable.c files are due by Wednesday, 11:59 pm, to be submitted on the SoC handin page at http://handin.cs.clemson.edu.
More informationWe will work with Turtles in a World in Java. Seymour Papert at MIT in the 60s. We have to define what we mean by a Turtle to the computer
Introduce Eclipse Create objects in Java Introduce variables as object references Aleksandar Stefanovski CSCI 053 Department of Computer Science The George Washington University Spring, 2010 Invoke methods
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 informationCMSC 150 LECTURE 1 INTRODUCTION TO COURSE COMPUTER SCIENCE HELLO WORLD
CMSC 150 INTRODUCTION TO COMPUTING ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH INTRODUCTION TO JAVA PROGRAMMING, LIANG (PEARSON 2014) LECTURE 1 INTRODUCTION TO COURSE COMPUTER SCIENCE
More informationAP Computer Science Unit 1. Writing Programs Using BlueJ
AP Computer Science Unit 1. Writing Programs Using BlueJ 1. Open up BlueJ. Click on the Project menu and select New Project. You should see the window on the right. Navigate to wherever you plan to save
More informationSyntax and Variables
Syntax and Variables What the Compiler needs to understand your program, and managing data 1 Pre-Processing Any line that starts with # is a pre-processor directive Pre-processor consumes that entire line
More informationQUIZ. What is wrong with this code that uses default arguments?
QUIZ What is wrong with this code that uses default arguments? Solution The value of the default argument should be placed in either declaration or definition, not both! QUIZ What is wrong with this code
More informationProgramming Project 1
Programming Project 1 Handout 6 CSCI 134: Fall, 2016 Guidelines A programming project is a laboratory that you complete on your own, without the help of others. It is a form of take-home exam. You may
More informationAlgorithms and Programming I. Lecture#12 Spring 2015
Algorithms and Programming I Lecture#12 Spring 2015 Think Python How to Think Like a Computer Scientist By :Allen Downey Installing Python Follow the instructions on installing Python and IDLE on your
More informationBjarne Stroustrup. creator of C++
We Continue GEEN163 I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone. Bjarne Stroustrup creator
More information1) Log on to the computer using your PU net ID and password.
CS 150 Lab Logging on: 1) Log on to the computer using your PU net ID and password. Connecting to Winter: Winter is the computer science server where all your work will be stored. Remember, after you log
More information