Tutorium für Studentinnen im 1. Semester

Size: px
Start display at page:

Download "Tutorium für Studentinnen im 1. Semester"

Transcription

1 Tutorium für Studentinnen im 1. Semester Der Frauenanteil in Informatik und Wirtschaftsinformatik ist sowohl unter den Beschäftigten und studentischen Hilfskräften als auch den Studienanfängern leider immer noch sehr gering. Deswegen bieten wir für euch in diesem Semester ein Tutorium speziell für Studentinnen an. Zum einen wollen wir euch den Einstieg ins Informatikstudium auf fachlicher Ebene erleichtern. Dafür stellen wir euch eine erfahrene Betreuerin zur Seite, die bei den wöchentlichen Übungsaufgaben und Verständnisfragen für euch da ist - ganz egal, um welches Modul es sich auch handelt. Zum anderen soll euch dieses Tutorium die Möglichkeit bieten, andere Studentinnen kennenzulernen und Ansprechpartner bei Problemen und Fragen nicht fachlicher Natur zu finden. Ihr könnt also auch gerne vorbeikommen, wenn es z.b. Schwierigkeiten mit Dozenten, Gruppenleitern oder Kommilitonen gibt. Das Tutorium findet ab dem jede Woche montags von 14:15-15:45 Uhr in CAP4 (Hochhaus) Raum 910 statt und wird von Janina Harms betreut. Wir laden alle Interessierten herzlich dazu ein, jederzeit und ohne Anmeldung vorbeizukommen. Tutorium für Studentinnen im 1. Semester Institut für Informatik Bei weiteren Fragen stehen wir euch gerne zur Verfügung Janina Harms Insa Stucke 1

2 infprogoo.de Wiki Termine 2

3 Punkte in 1. Klausur / Übungspunkte ,0 2,0 3,0 4, Gesamtpunkte in Übungsserien 3

4 Punkte in 1. Klausur (> 0, nur Erstversuche) ,0 2,0 3,0 4, Gesamtpunkte in Übungsserien 4

5 Five-Minute Review 1. What steps do we distinguish in solving a problem by computer? 2. What are essential properties of an algorithm? 3. What is a definition of Software Engineering? 4. What types of programming error do we distinguish? 5. What is the difference between compilation and interpretation? 5

6 Programming Lecture 2 Programming by example (Chapter 2) Hello world Patterns Classes, objects Graphical programming 6

7 C H A P T E R 2 Programming by Example The Art and Science of ERIC S. ROBERTS Java An Introduction to Computer Science Example is always more efficacious than precept. Samuel Johnson, Rasselas, The Hello world program 2.2 Perspectives on the programming process 2.3 A program to add two numbers 2.4 Programming idioms and patterns 2.5 Classes and objects 2.6 Graphical programs 7

8 1.1 Getting Started The only way to learn a new programming language is to write programs in it. The first program to write is the same for all languages: Print the words hello, world This is the big hurdle; to leap over it you have to be able to create the program text somewhere, compile it, load it, run it, and find out where your output went. With these mechanical details mastered, everything else is comparatively easy. is In C, the program to print hello, world #include <stdio.h> main() { printf("hello, world"); } 8

9 The Hello World Program in Java This A In The class Java, object next arguments last simple first method definition objects few slide two few to Hello be lines simulates consists supply are lines added created in are World Java (everything the information is of the indicated file atypically by imports, series operation example using define of between by that acontains which statements. the constructor, illustrates of supplying the HelloProgram indicate /* constructor a series and several which Here, argument what */) ofneeds the consists features entries. are so library class, only that an to that example packages which This statement of make youthe add are can example the keyword common method. get of object, the is extends a program comment, sense has call new such to Here, one toof the followed keyword add, as entry, uses. what programs the which argument appears string by identifies isadds the you intended to ison class display a will an method the a object new name see adisplay. for GraphicsProgram. and in GLabel human called to and this the arguments. book. coordinates. run. display. readers. object. /* * File: HelloProgram.java * * This program displays "hello, world" on the screen. * It is inspired by the first program in Brian * Kernighan and Dennis Ritchie's classic book, * The C Programming Language. */ import acm.graphics.*; import acm.program.*; public class HelloProgram extends GraphicsProgram { public void run() { add( new GLabel( "hello, world", 100, 75 ) ); } } 9

10 Hello World "Standard Java" public class HelloWorld { public static void main (String[] args) { System.out.println("Hello World!"); } } 10

11 Hello World "Standard Java" public class HelloWorld { public static void main (String[] args) { System.out.println("Hello World!"); } } 11

12 Hello World "ACM Java" import acm.program.consoleprogram; public class HelloWorld extends ConsoleProgram { public void run() { println("hello World!"); } } 12

13 Rationale for ACM Java We use ACM Java for didactic purposes Programs are treated as objects, no static main method Historic baggage from C is hidden Examples are compatible with text book Easy to switch console/graphical programs For further details, see the home page of the ACM Java Task Force: 13

14 import acm.graphics.*; import acm.program.*; public class HelloProgram extends GraphicsProgram { public void run() { add( new GLabel("hello, world", 100, 75) ); } } HelloProgram hello, world 14

15 Hello World (on a bad day...) 15 15

16 The Magic of Ctrl-Shift-F (Cmd-Shift-F) 16 16

17 Much Better... PLEASE submit only code that is properly formatted! 17 17

18 GPL Beginning of line: indentation (Einrückung), use tabs Within line: alignment (Ausrichtung), use spaces Eclipse automatically does the right thing See also 18

19 Perspectives on the Programming Process In his Pulitzer-prizewinning book, computer scientist Douglas Hofstadter identifies two concepts holism and reductionism that turn out to be important as you begin to learn about programming. Hofstadter explains these concepts in the form of a dialogue in the style of Lewis Carroll: Achilles: Crab: I will be glad to indulge both of you, if you will first oblige me, by telling me the meaning of these strange expressions, holism and reductionism. Holism is the most natural thing in the world to grasp. It s simply the belief that the whole is greater than the sum of its parts. No one in his right mind could reject holism. Anteater: Reductionism is the most natural thing in the world to grasp. It s simply the belief that a whole can be understood completely if you understand its parts, and the nature of their sum. No one in her left brain could reject reductionism. 19

20 A Program to Add Two Numbers This As Theyou next final holistic first program saw two slide statement perspective in statements isanimates theexample computes in case read isof run program particularly operation of the method a ConsoleProgram, sum HelloProgram input prints of by displays values useful this adding a message program from when the example, result. the values you which to user, illustrate the are In stored reads each Java user first this learning input programs describing of statement, the the which assignment from variables tois written the what program. a + whole of keyboard the operator n1 values using program and number, When to signifies n2. the and variables. does. you acm.program displays which In look this concatenation, isstatement, characters more program, package formally the which on you the + begin called operator consists screen. should by an concentrate Such executing integer. represents of combining programs the The addition, statements the understanding input are operands as not values as standard together exciting theare its run operation stored mathematics. as method. strings. graphical memory a general applications cells way called rather but than are variables useful focusing that for illustrating serve on as theplaceholders programming details. Consider, forconcepts. those values. for example, the following program, which adds two integers and prints their sum: import acm.program.*; public class Add2Integers extends ConsoleProgram { public void run() { println("this program adds two numbers."); int n1 = readint("enter n1: "); int n2 = readint("enter n2: "); int total = n1 + n2; println("the total is " + total + "."); } } 20

21 Variables Variable: placeholder for a piece of data; "a box to put something into" Name (Identifier) Type Value 21

22 int x = 42; Variable Declarations A declaration of a variable (with name) x of type int with initial value 42 Syntax template for declaration: type identifier [ = expression ]; where square brackets [] denote optional part, here the optional initialization of a variable 22

23 Variables class Add2Integers extends ConsoleProgram { public void run() { println("this program adds two numbers."); int n1 = readint("enter n1: "); int n2 = readint("enter n2: "); int total = n1 + n2; println("the total is " + total + "."); } } n1 n2 total Add2Integers This program adds two numbers. Enter n1: 17 Enter n2: 25 The total is

24 Programming Idioms and Patterns Experienced programmers also often take a holistic approach to programming. Effective programmers can recognize a variety of common operations and have learned a standard solution strategy for each one. The code that implements such a solution strategy is called a programming idiom or programming pattern. Learning to use these patterns saves you from having to think about the nitty-gritty details. As an example, it is important to think of a statement like int n1 = readint("enter n1: "); not in terms of what each part of the statement means, but rather as a holistic pattern to read an integer from the user: int variable = readint("prompt"); 24

25 Java Packages Typically a collection of useful classes A.k.a. "library packages" or "libraries" Syntax: import package.class; 25

26 Java Packages If several classes from same package are needed, may abbreviate: import package.*; Name of package may also include ".", but cannot use * to include several packages Advice: Use * sparingly Let the IDE Content Assist add import statements for you (Eclipse: Ctrl-Space) 26

27 Comments // A one-line comment // Another one-line comment /* * A longer comment. * Every program deserves a comment - * except for those programs * that only live on slides. * You may write comments in German, * but we encourage you to try English. */ 27

28 Programming Idioms / Patterns Holistic vs. reductionistic Holistic pattern read integer from user : int variable = readint("prompt"); 28

29 Core Object-Oriented (OO) Terminology Class: template for individual objects Object: an instance of a particular class Method: named sequence of program steps (statements) Constructor: special method that creates new objects Syntax: new constructor (arguments) 29

30 30

31 31

32 Core OO Terminology Object variable: a variable whose type is a class, and which holds a reference to an instance of that class Note: (object) variables have names, but objects don't Classes form hierarchies, a subclass extends (inherits from) a superclass Syntax: class subclass extends superclass 32

33 Classes and Objects As described in the slides for Chapter 1, Java programs are written as collections of classes, which serve as templates for individual objects. Each object is an instance of a particular class, which can serve as a pattern for many different objects. Classes in Java form hierarchies. Except for the class named Object that stands at the top of the hierarchy, every class in Java is a subclass of some other class, which is called its superclass. A class can have many subclasses, but each class has only one superclass. A class represents a specialization of its superclass. If you create an object that is an instance of a class, that object is also an instance of all other classes in the hierarchy above it in the superclass chain. When you define a new class in Java, that class automatically inherits the behavior of its superclass. 33

34 Biological Models of Class Structure The structure of Java s class hierarchy resembles the biological classification scheme introduced by Scandinavian botanist Carl Linnaeus in the 18th century. Linnaeus s contribution was to recognize that organisms fit into a hierarchical classification scheme in which the placement of individual species reflects anatomical similarities. Carl Linnaeus ( ) 34

35 Biological Class Hierarchy Living Things Kingdom Plants Animals Fungi Phylum Annelida Brachiopoda Arthropoda Mollusca Chordata Order Crustacea Insecta Arachnida Class Family Genus Species Classification of the red ant Iridomyrmex purpureus Hymenoptera Formicidae Iridomyrmex purpureus Every red ant is also an animal, an arthropod, and an insect, as well as the other superclasses 35 in the chain.

36 The acm.program Hierarchy Applet JApplet Program ConsoleProgram DialogProgram GraphicsProgram 36

37 The DialogProgram Class public class Add2Integers extends DialogProgram { public void run() { println("this program adds two numbers."); int n1 = readint("enter n1: "); int n2 = readint("enter n2: "); int total = n1 + n2; println("the total is " + total + "."); } } 37

38 Graphical Programs The GraphicsProgram class makes it possible to create simple pictures on the screen. The conceptual model is that of a collage composed of objects on a canvas. Running a GraphicsProgram creates a window that serves as the background canvas for the collage. You create pictures by creating graphical objects of various kinds and then adding those objects to the canvas. In this chapter, you will learn how to work with labels, rectangles, ovals, and lines using the classes GLabel, GRect, GOval, and GLine. The complete set of graphics classes is introduced in Chapter 9. 38

39 Sending Messages to Objects In many applications, you will need to change the appearance of a graphical object after you have created it. For example, you might want to have the object change its color or move to a new position on the canvas. In object-oriented languages like Java, such changes are the responsibility of the object. To change the color of an object you send a message to the object asking it to change color. Java uses the following syntax to send a message to an object: receiver.name(arguments); where receiver is the object to which the message is directed, name identifies the type of message, and arguments is a list of values used to specify any other information associated with the message. 39

40 Sending Messages to Objects receiver.method(arguments); public class HelloProgram extends GraphicsProgram { public void run() { GLabel label = new GLabel("hello, world", 100, 75); label.setfont("sansserif-36"); label.setcolor(color.red); add(label); } label } hello, world HelloProgram hello, world 40 skip simulation

41 The Java Coordinate System Positions and distances in a graphics program are measured in terms of pixels, which are the individual dots that cover the screen. Unlike traditional mathematics, Java defines the origin of the coordinate system to be in the upper left corner. Values for the x coordinate increase as you move rightward across the screen; y coordinate values increase as you move downward. Creating a JLabel at a particular x and y position means that the baseline of the first character in the label appears at that point, as follows: HelloProgram (100, 75) Hello 41

42 The GObject Hierarchy GObject GLabel GRect GOval GLine 42

43 Wikipedia / marcel4995 / CC 43

44 Operations on the GObject Class object.setcolor(color) Sets color of object to specified color constant. object.setlocation(x, y) Changes location of object to point (x, y). object.move(dx, dy) Moves object on screen by adding dx and dy to its current coordinates. Standard color names, defined in java.awt package: Color.BLACK Color.DARK_GRAY Color.GRAY Color.LIGHT_GRAY Color.WHITE Color.RED Color.YELLOW Color.GREEN Color.CYAN Color.BLUE Color.MAGENTA Color.ORANGE Color.PINK 44

45 Operations on the GLabel Class Constructor new GLabel(text, x, y) Creates a label containing the specified text that begins at the point (x, y). Methods specific to GLabel class label.setfont( font) Sets the font used to display the label as specified by the font string. Font typically specified as string "family-style-size" where family denotes font family style is either PLAIN, BOLD, ITALIC, or BOLDITALIC size is integer indicating point size 45

46 Drawing Geometrical Objects Constructors new GRect( x, y, width, height) Creates a rectangle whose upper left corner is at (x, y) of the specified size. new GOval( x, y, width, height) Creates an oval that fits inside the rectangle with the same dimensions. new GLine( x 0, y 0, x 1, y 1 ) Creates a line extending from (x 0, y 0 ) to (x 1, y 1 ). Methods shared by the GRect and GOval classes object.setfilled( fill) If fill is true, fills in the interior of the object; if false, shows only the outline. object.setfillcolor( color) Sets the color used to fill the interior, which can be different from the border. 46

47 The GRectPlusGOval Program public class GRectPlusGOval extends GraphicsProgram { public void run() { GRect rect = new GRect(100, 50, 125, 60); rect.setfilled(true); rect.setcolor(color.red); add(rect); GOval oval = new GOval(100, 50, 125, 60); oval.setfilled(true); oval.setfillcolor(color.green); add(oval); rect oval } } GRectPlusGOval 47 skip simulation

48 Summary Got started with hello world Holistic vs. reductionistic Classes form hierarchy, subclass inherits from superclass Objects are instances of a class Java coordinates GObjects 48

Programming Lecture 2. Programming by example (Chapter 2) Hello world Patterns Classes, objects Graphical programming

Programming Lecture 2. Programming by example (Chapter 2) Hello world Patterns Classes, objects Graphical programming Five-Minute Review 1. What steps do we distinguish in solving a problem by computer? 2. What are essential properties of an algorithm? 3. What is a definition of Software Engineering? 4. What types of

More information

Programming Lecture 2. Programming by example (Chapter 2) Hello world Patterns Classes, objects Graphical programming

Programming Lecture 2. Programming by example (Chapter 2) Hello world Patterns Classes, objects Graphical programming Five-Minute Review 1. What steps do we distinguish in solving a problem by computer? 2. What are essential properties of an algorithm? 3. What is a definition of Software Engineering? 4. What types of

More information

Variables, Types, and Expressions

Variables, Types, and Expressions Variables, Types, and Expressions Announcements Karel the Robot due right now. Email: Due Sunday, January 22 at 11:59PM. Update to assignment due dates: Assignments 2 5 going out one day later. Contact

More information

JavaScript Programs Once upon a time...

JavaScript Programs Once upon a time... JavaScript Programs Once upon a time... Jerry Cain CS 106AJ October 3, 2018 slides courtesy of Eric Roberts The World Wide Web One of the strengths of JavaScript is its integration with the World Wide

More information

Object-Oriented Programming

Object-Oriented Programming Object-Oriented Programming Casual Dinner for Women in CS Next Thursday, January 24 in Gates 219 at 6:00PM. Good food, great company, and everyone is invited! RSVP through email link (sent out earlier

More information

JavaScript Programs. Jerry Cain CS 106AJ October 4, 2017

JavaScript Programs. Jerry Cain CS 106AJ October 4, 2017 JavaScript Programs Jerry Cain CS 106AJ October 4, 2017 Once upon a time... The World Wide Web One of the strengths of JavaScript is its integration with the World Wide Web, which was invented by Tim Berners-Lee

More information

Expressions, Statements, and Control Structures

Expressions, Statements, and Control Structures Expressions, Statements, and Control Structures Announcements Assignment 2 out, due next Wednesday, February 1. Explore the Java concepts we've covered and will be covering. Unleash your creative potential!

More information

Getting Familiar with ACM_JTF

Getting Familiar with ACM_JTF Getting Familiar with ACM_JTF PART1: Introduction to the JTF Packages In early 2004, the ACM created the Java Task Force (JTF) to review the Java language, APIs, and tools from the perspective of introductory

More information

Objects and Graphics

Objects and Graphics Objects and Graphics One Last Thought on Loops... Looping Forever while loops iterate as long as their condition evaluates to true. A loop of the form while (true) will loop forever (unless something stops

More information

CS 106A, Lecture 11 Graphics

CS 106A, Lecture 11 Graphics CS 106A, Lecture 11 Graphics reading: Art & Science of Java, 9.1-9.3 This document is copyright (C) Stanford Computer Science and Marty Stepp, licensed under Creative Commons Attribution 2.5 License. All

More information

Introduction to Java

Introduction to Java Introduction to Java Announcements Programming Assignment #1 Out: Karel the Robot: Due Friday, January 20 at 3:15 PM. Email: Due Sunday, January 22 at 11:59PM. Section Assignments Posted Check online at

More information

What is Java? professional software engineering.

What is Java? professional software engineering. Welcome Back! Welcome to Java! What is Java? Java is an industrial programming language used to build large applications. Used in web servers, Android phones, desktop applications, etc. Extremely common:

More information

Quick Reference. There are several already named colors which you can use, but you must import the appropriate Java library.

Quick Reference. There are several already named colors which you can use, but you must import the appropriate Java library. Quick Reference This appendix contain information on many of the useful objects and methods related to this book. Some are used in the book, others are just extras you may want to explore to add extra

More information

Solutions for Section #2

Solutions for Section #2 Chris Piech Section #2 CS 106A January 24, 2018 Solutions for Section #2 1. The Fibonacci sequence Portions of this handout by Eric Roberts and Jeremy Keeshin * File: Fibonacci.java * This program lists

More information

Assignment 2: Welcome to Java!

Assignment 2: Welcome to Java! CS106A Winter 2011-2012 Handout #12 January 23, 2011 Assignment 2: Welcome to Java! Based on a handout by Eric Roberts and Mehran Sahami Having helped Karel the Robot through the challenges of Assignment

More information

Programming Lecture 4

Programming Lecture 4 Five-Minute Review 1. What is a class hierarchy? 2. Which graphical coordinate system is used by Java (and most other languages)? 3. Why is a collage a good methapher for GObjects? 4. What is a CFG? What

More information

Programming Lecture 4

Programming Lecture 4 Five-Minute Review 1. What are classes and objects? What is a class hierarchy? 2. What is an expression? A term? 3. What is a variable declaration? 4. What is an assignment? What is precedence? 5. What

More information

Programming Lecture 4

Programming Lecture 4 Five-Minute Review 1. What is a class hierarchy? 2. Which graphical coordinate system is used by Java (and most other languages)? 3. Why is a collage a good methapher for GObjects? 4. What is a CFG? What

More information

Solutions for Section #2

Solutions for Section #2 Chris Piech Handout #12A CS 106A January 25, 2017 Solutions for Section #2 1. The Fibonacci sequence Portions of this handout by Eric Roberts and Jeremy Keeshin * File: Fibonacci.java * --------------------

More information

Programming Lecture 4

Programming Lecture 4 Five-Minute Review 1. What are classes and objects? What is a class hierarchy? 2. What is an expression? A term? 3. What is a variable declaration? 4. What is an assignment? What is precedence? 5. What

More information

Programming via Java Subclasses

Programming via Java Subclasses Programming via Java Subclasses Every class in Java is built from another Java class. The new class is called a subclass of the other class from which it is built. A subclass inherits all the instance

More information

Assignment #2: Simple Java Programs Due: 1:15pm on Friday, April 19th

Assignment #2: Simple Java Programs Due: 1:15pm on Friday, April 19th Steve Cooper Handout #13 CS 106A April 12, 2013 Assignment #2: Simple Java Programs Due: 1:15pm on Friday, April 19th Your Early Assignment Help (YEAH) hours: time: tbd, Tues., Apr. 16th in location:tbd

More information

Drawing Geometrical Objects. Graphic courtesy of Eric Roberts

Drawing Geometrical Objects. Graphic courtesy of Eric Roberts Methods Drawing Geometrical Objects Graphic courtesy of Eric Roberts Drawing Geometrical Objects Constructors new GRect( x, y, width, height) Creates a rectangle whose upper left corner is at (x, y) of

More information

@Override public void start(stage primarystage) throws Exception { Group root = new Group(); Scene scene = new Scene(root);

@Override public void start(stage primarystage) throws Exception { Group root = new Group(); Scene scene = new Scene(root); Intro to Drawing Graphics To draw some simple graphics, we first need to create a window. The easiest way to do this in the current version of Java is to create a JavaFX application. Previous versions

More information

CS 106A, Lecture 14 Events and Instance Variables

CS 106A, Lecture 14 Events and Instance Variables CS 106A, Lecture 14 Events and Instance Variables Reading: Art & Science of Java, Ch. 10.1-10.4 This document is copyright (C) Stanford Computer Science and Marty Stepp, licensed under Creative Commons

More information

Slide 1 CS 170 Java Programming 1 Object-Oriented Graphics Duration: 00:00:18 Advance mode: Auto

Slide 1 CS 170 Java Programming 1 Object-Oriented Graphics Duration: 00:00:18 Advance mode: Auto CS 170 Java Programming 1 Object-Oriented Graphics The Object-Oriented ACM Graphics Classes Slide 1 CS 170 Java Programming 1 Object-Oriented Graphics Duration: 00:00:18 Hello, Welcome to the CS 170, Java

More information

SUBCLASSES IN JAVA - II

SUBCLASSES IN JAVA - II SUBCLASSES IN JAVA - II Subclasses and variables Any instance of a class A can also be treated as an instance of a superclass of A. Thus, if B is a superclass of A, then every A object can also be treated

More information

Interactive Graphics

Interactive Graphics Interactive Graphics Eric Roberts CS 106A January 27, 2010 The acm.graphics Model The acm.graphics package uses a collage model in which you create an image by adding various objects to a canvas. A collage

More information

Interactive Graphics. Eric Roberts Handout #23 CS 106A January 25, 2016 Interactive Graphics. Computer Graphics and the Utah Teapot.

Interactive Graphics. Eric Roberts Handout #23 CS 106A January 25, 2016 Interactive Graphics. Computer Graphics and the Utah Teapot. Eric Roberts Handout #23 CS 106A January 25, 2016 Interactive Graphics Interactive Graphics Computer Graphics and the Utah Teapot Eric Roberts CS 106A January 25, 2016 Computer Graphics and the Utah Teapot

More information

Revisiting acm.graphics

Revisiting acm.graphics Revisiting acm.graphics collage model create image by adding objects to a canvas Newer objects obscure those added earlier Layering is called the stacking order (or z-order) Structure of acm.graphics Package

More information

Nested Loops Chris Piech CS106A, Stanford University. Piech, CS106A, Stanford University

Nested Loops Chris Piech CS106A, Stanford University. Piech, CS106A, Stanford University Nested Loops Chris Piech CS106A, Stanford University By Chris Once upon a time X was looking for love! int x = 5; if(lookingforlove()) { int y = 5; println(x + y); 5 x X was looking for love! int x =

More information

CS 106A, Lecture 14 Events and Instance Variables

CS 106A, Lecture 14 Events and Instance Variables CS 106A, Lecture 14 Events and Instance Variables Reading: Art & Science of Java, Ch. 10.1-10.4 This document is copyright (C) Stanford Computer Science and Marty Stepp, licensed under Creative Commons

More information

Simple Java YEAH Hours. Brahm Capoor and Vrinda Vasavada

Simple Java YEAH Hours. Brahm Capoor and Vrinda Vasavada Simple Java YEAH Hours Brahm Capoor and Vrinda Vasavada What are YEAH hours? Held soon after each assignment is released Help you to get an early start on your assignments Future dates TBA Slides will

More information

CSC System Development with Java Introduction to Java Applets Budditha Hettige

CSC System Development with Java Introduction to Java Applets Budditha Hettige CSC 308 2.0 System Development with Java Introduction to Java Applets Budditha Hettige Department of Statistics and Computer Science What is an applet? applet: a Java program that can be inserted into

More information

Programming via Java Defining classes

Programming via Java Defining classes Programming via Java Defining classes Our programs so far have used classes, like Turtle and GOval, which were written by other people. In writing larger programs, we often find that another class would

More information

Chapter 2 ACM Java Graphics

Chapter 2 ACM Java Graphics Chapter 2 ACM Java Graphics The ACM Library provides a big toolkit that makes cool programming accessible to the beginner. But there s a lot to learn. This chapter shows you the most useful tools and techniques,

More information

File: GFace.java /* * File: GFace.java * This class implements a face as a GCompound. */

File: GFace.java /* * File: GFace.java * This class implements a face as a GCompound. */ Steve Cooper Handout #22 CS 106A April 24, 2013 Graphics and Events Examples File: GFace.java * File: GFace.java * This class implements a face as a GCompound. // Note: only need acm.graphics since this

More information

Throughout the semester: questions slides book programming review questions practice exam

Throughout the semester: questions slides book programming review questions practice exam Five-Minute Review 1. What are expression statements? Compound statements? 2. What is a scope? 3. What are conditional statements in Java? How about iterative statements? 4. In conditionals, why should

More information

Java TM Applets. Rex Jaeschke

Java TM Applets. Rex Jaeschke Java TM Applets Rex Jaeschke Java Applets 1997 1998, 2009 Rex Jaeschke. All rights reserved. Edition: 3.0 (matches JDK1.6/Java 2) All rights reserved. No part of this publication may be reproduced, stored

More information

Variables Chris Piech CS106A, Stanford University. Piech, CS106A, Stanford University

Variables Chris Piech CS106A, Stanford University. Piech, CS106A, Stanford University Variables Chris Piech CS106A, Stanford University New Ability Write a program that calculates the tax, tip and total bill for us at a restaurant. The program should ask the user for the subtotal, and then

More information

Guide to Success I. in December)

Guide to Success I. in December) Five-Minute Review 1. What are expression statements? Compound statements? 2. What is a scope? 3. What are conditional statements in Java? How about iterative statements? 4. In conditionals, why should

More information

In this lecture we will briefly examine a few new controls, introduce the concept of scope, random numbers, and drawing simple graphics.

In this lecture we will briefly examine a few new controls, introduce the concept of scope, random numbers, and drawing simple graphics. Additional Controls, Scope, Random Numbers, and Graphics CS109 In this lecture we will briefly examine a few new controls, introduce the concept of scope, random numbers, and drawing simple graphics. Combo

More information

Assignment A7 BREAKOUT CS1110 Spring 2011 Due Fri 6 May 1

Assignment A7 BREAKOUT CS1110 Spring 2011 Due Fri 6 May 1 Assignment A7 BREAKOUT CS1110 Spring 2011 Due Fri 6 May 1 This assignment, including much of the wording of this document, is taken from an assignment from Stanford University, by Professor Eric Roberts.

More information

MetriKon format guidelines for proceedings papers

MetriKon format guidelines for proceedings papers MetriKon Format Guidelines MetriKon format guidelines for proceedings papers First author, second author, third author Affiliation of the author/s (company/university) Email-address/es of the author/s

More information

Graphics Applets. By Mr. Dave Clausen

Graphics Applets. By Mr. Dave Clausen Graphics Applets By Mr. Dave Clausen Applets A Java application is a stand-alone program with a main method (like the ones we've seen so far) A Java applet is a program that is intended to transported

More information

Wentworth Institute of Technology. Engineering & Technology WIT COMP1000. Java Basics

Wentworth Institute of Technology. Engineering & Technology WIT COMP1000. Java Basics WIT COMP1000 Java Basics Java Origins Java was developed by James Gosling at Sun Microsystems in the early 1990s It was derived largely from the C++ programming language with several enhancements Java

More information

Graphics and Java 2D Introduction OBJECTIVES. One picture is worth ten thousand words.

Graphics and Java 2D Introduction OBJECTIVES. One picture is worth ten thousand words. 1 2 12 Graphics and Java 2D One picture is worth ten thousand words. Chinese proverb Treat nature in terms of the cylinder, the sphere, the cone, all in perspective. Paul Cézanne Colors, like features,

More information

CS 106A Midterm Review. Rishi Bedi, adapted from slides by Kate Rydberg and Nick Troccoli Summer 2017

CS 106A Midterm Review. Rishi Bedi, adapted from slides by Kate Rydberg and Nick Troccoli Summer 2017 + CS 106A Midterm Review Rishi Bedi, adapted from slides by Kate Rydberg and Nick Troccoli Summer 2017 Details n Only the textbook is allowed n n n The Art and Science of Java Karel Course Reader You will

More information

CS 170 Java Programming 1. Week 7: More on Logic

CS 170 Java Programming 1. Week 7: More on Logic CS 170 Java Programming 1 Week 7: More on Logic What s the Plan? Topic 1: A Little Review Use relational operators to compare values Write functions using if and else to make decisions Topic 2: New Logical

More information

Guide to Success I. in December)

Guide to Success I. in December) Five-Minute Review 1. What are expression statements? Compound statements? 2. What is a scope? 3. What are conditional statements in Java? How about iterative statements? 4. In conditionals, why should

More information

A PROGRAM IS A SEQUENCE of instructions that a computer can execute to

A PROGRAM IS A SEQUENCE of instructions that a computer can execute to A PROGRAM IS A SEQUENCE of instructions that a computer can execute to perform some task. A simple enough idea, but for the computer to make any use of the instructions, they must be written in a form

More information

Command-Line Applications. GUI Libraries GUI-related classes are defined primarily in the java.awt and the javax.swing packages.

Command-Line Applications. GUI Libraries GUI-related classes are defined primarily in the java.awt and the javax.swing packages. 1 CS257 Computer Science I Kevin Sahr, PhD Lecture 14: Graphical User Interfaces Command-Line Applications 2 The programs we've explored thus far have been text-based applications A Java application is

More information

Praktische Aspekte der Informatik. Thomas Löwe Prof. Marcus Magnor

Praktische Aspekte der Informatik. Thomas Löwe Prof. Marcus Magnor Praktische Aspekte der Informatik Thomas Löwe Prof. Marcus Magnor Your Proposal It s due 15.05.2016! It s due 22.05.2016! Software Versioning SVN basics, workflow, and commands Further Reading Warning!

More information

CS 106A, Lecture 25 Life After CS 106A, Part 1

CS 106A, Lecture 25 Life After CS 106A, Part 1 CS 106A, Lecture 25 Life After CS 106A, Part 1 This document is copyright (C) Stanford Computer Science and Marty Stepp, licensed under Creative Commons Attribution 2.5 License. All rights reserved. Based

More information

Connection Guide Link ECU

Connection Guide Link ECU Connection Guide Link ECU Can Bus Connection Atom/Monsun: Pin 28 (Can High) + Pin 29 (CAN Low) Storm (Black)/Fury/Xtreme/Force GDI: Pin B27 (Can2 High) + Pin B28 (CAN2 Low) Kurofune: Pin JST3 (Can High)

More information

Assignment #2: Simple Java Programs Due: 11AM PST on Monday, Jan 29 th

Assignment #2: Simple Java Programs Due: 11AM PST on Monday, Jan 29 th Chris Piech Handout #8 CS 106A Jan 19, 2018 Assignment #2: Simple Java Programs Due: 11AM PST on Monday, Jan 29 th This assignment should be done individually (not in pairs) Portions of this handouts by

More information

Lecture 02, Fall 2018 Friday September 7

Lecture 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 information

(0,0) (600, 400) CS109. PictureBox and Timer Controls

(0,0) (600, 400) CS109. PictureBox and Timer Controls CS109 PictureBox and Timer Controls Let s take a little diversion and discuss how to draw some simple graphics. Graphics are not covered in the book, so you ll have to use these notes (or the built-in

More information

SSEA Computer Science: CS106A. Dr. Cynthia Lee Lecturer in Computer Science Stanford

SSEA Computer Science: CS106A. Dr. Cynthia Lee Lecturer in Computer Science Stanford SSEA Computer Science: CS106A Dr. Cynthia Lee Lecturer in Computer Science Stanford Topics for today Learn how to harness computing power to solve problems. To that end: Introduce Java programming language

More information

Starting Out with Java: From Control Structures Through Objects Sixth Edition

Starting Out with Java: From Control Structures Through Objects Sixth Edition Starting Out with Java: From Control Structures Through Objects Sixth Edition Chapter 12 A First Look at GUI Applications Chapter Topics 12.1 Introduction 12.2 Creating Windows 12.3 Equipping GUI Classes

More information

Chapter 3 - Introduction to Java Applets

Chapter 3 - Introduction to Java Applets 1 Chapter 3 - Introduction to Java Applets 2 Introduction Applet Program that runs in appletviewer (test utility for applets) Web browser (IE, Communicator) Executes when HTML (Hypertext Markup Language)

More information

Modern and Lucid C++ for Professional Programmers. Week 15 Exam Preparation. Department I - C Plus Plus

Modern and Lucid C++ for Professional Programmers. Week 15 Exam Preparation. Department I - C Plus Plus Department I - C Plus Plus Modern and Lucid C++ for Professional Programmers Week 15 Exam Preparation Thomas Corbat / Prof. Peter Sommerlad Rapperswil, 08.01.2019 HS2018 Prüfung 2 Durchführung Mittwoch

More information

This module sets out essential concepts and skills relating to demonstrating competence in using presentation software.

This module sets out essential concepts and skills relating to demonstrating competence in using presentation software. ECDL / ICDL Presentation This module sets out essential concepts and skills relating to demonstrating competence in using presentation software. Module Goals Successful candidates will be able to: Work

More information

JAVA: A Primer. By: Amrita Rajagopal

JAVA: A Primer. By: Amrita Rajagopal JAVA: A Primer By: Amrita Rajagopal 1 Some facts about JAVA JAVA is an Object Oriented Programming language (OOP) Everything in Java is an object application-- a Java program that executes independently

More information

Java Bytecode (binary file)

Java 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 information

CS 106A, Lecture 23 Interactors and GCanvas

CS 106A, Lecture 23 Interactors and GCanvas CS 106A, Lecture 23 Interactors and GCanvas suggested reading: Java Ch. 10.5-10.6 This document is copyright (C) Stanford Computer Science and Marty Stepp, licensed under Creative Commons Attribution 2.5

More information

Ruby: Introduction, Basics

Ruby: Introduction, Basics Ruby: Introduction, Basics Computer Science and Engineering College of Engineering The Ohio State University Lecture 3 Ruby vs Java: Similarities Imperative and object-oriented Classes and instances (ie

More information

Inheritance and Interfaces

Inheritance and Interfaces Inheritance and Interfaces Object Orientated Programming in Java Benjamin Kenwright Outline Review What is Inheritance? Why we need Inheritance? Syntax, Formatting,.. What is an Interface? Today s Practical

More information

Simple Arrays. Eric Roberts CS 106A February 15, 2017

Simple Arrays. Eric Roberts CS 106A February 15, 2017 Simple Arrays Eric Roberts CS 106A February 15, 2017 Once upon a time... A Quick Review of Array Lists In Java, an array list is an abstract type used to store a linearly ordered collection of similar

More information

Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Lecture - 04 Introduction to Programming Language Concepts

More information

ITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University

ITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University ITC213: STRUCTURED PROGRAMMING Bhaskar Shrestha National College of Computer Studies Tribhuvan University Lecture 04: Introduction to C Readings: Chapter 1.5-1.7 What is C? C is a general-purpose, structured

More information

CSC 1051 Data Structures and Algorithms I. Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University

CSC 1051 Data Structures and Algorithms I. Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Graphics & Applets CSC 1051 Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website: www.csc.villanova.edu/~map/1051/ Back to Chapter

More information

Search Engines Chapter 2 Architecture Felix Naumann

Search Engines Chapter 2 Architecture Felix Naumann Search Engines Chapter 2 Architecture 28.4.2009 Felix Naumann Overview 2 Basic Building Blocks Indexing Text Acquisition iti Text Transformation Index Creation Querying User Interaction Ranking Evaluation

More information

Microsoft Office. Microsoft Office

Microsoft Office. Microsoft Office is an office suite of interrelated desktop applications, servers and services for the Microsoft Windows. It is a horizontal market software that is used in a wide range of industries. was introduced by

More information

CMSC 113: Computer Science I Review Questions for Exam #1

CMSC 113: Computer Science I Review Questions for Exam #1 CMSC 113: Computer Science I Review Questions for Exam #1 During the actual exam, you will have access to whatever printed resources you like, but no electronic resources of any sort. Part I. Each of the

More information

CISC 1600 Lecture 3.1 Introduction to Processing

CISC 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 information

Creating Java Programs with Greenfoot

Creating Java Programs with Greenfoot Creating Java Programs with Greenfoot Using Randomization and Understanding Dot Notation and Constructors 1 Copyright 2012, Oracle and/or its affiliates. All rights Overview This lesson covers the following

More information

Array Basics: Outline. Creating and Accessing Arrays. Creating and Accessing Arrays. Arrays (Savitch, Chapter 7)

Array Basics: Outline. Creating and Accessing Arrays. Creating and Accessing Arrays. Arrays (Savitch, Chapter 7) Array Basics: Outline Arrays (Savitch, Chapter 7) TOPICS Array Basics Arrays in Classes and Methods Programming with Arrays Searching and Sorting Arrays Multi-Dimensional Arrays Static Variables and Constants

More information

The following is the Syllabus for Module 6, Presentation, which is the basis for the practice-based test in this module.

The following is the Syllabus for Module 6, Presentation, which is the basis for the practice-based test in this module. Module 6 Presentation The following is the Syllabus for Module 6, Presentation, which is the basis for the practice-based test in this module. Module Goals Module 6 Presentation requires the candidate

More information

Chapter 3 Syntax, Errors, and Debugging. Fundamentals of Java

Chapter 3 Syntax, Errors, and Debugging. Fundamentals of Java Chapter 3 Syntax, Errors, and Debugging Objectives Construct and use numeric and string literals. Name and use variables and constants. Create arithmetic expressions. Understand the precedence of different

More information

CS/ENGRD 2110 SPRING Lecture 2: Objects and classes in Java

CS/ENGRD 2110 SPRING Lecture 2: Objects and classes in Java 1 CS/ENGRD 2110 SPRING 2014 Lecture 2: Objects and classes in Java http://courses.cs.cornell.edu/cs2110 Java OO (Object Orientation) 2 Python and Matlab have objects and classes. Strong-typing nature of

More information

First Name: AITI 2004: Exam 2 July 19, 2004

First Name: AITI 2004: Exam 2 July 19, 2004 First Name: AITI 2004: Exam 2 July 19, 2004 Last Name: JSP Track Read Instructions Carefully! This is a 3 hour closed book exam. No calculators are allowed. Please write clearly if we cannot understand

More information

CSc 328, Spring 2004 Final Examination May 12, 2004

CSc 328, Spring 2004 Final Examination May 12, 2004 Name: CSc 328, Spring 2004 Final Examination May 12, 2004 READ THIS FIRST Fill in your name above. Do not turn this page until you are told to begin. Books, and photocopies of pages from books MAY NOT

More information

Installation, Storage and Compute with Windows Server Online-Training Examen 740. Ausbildungsinhalte. ITKservice

Installation, Storage and Compute with Windows Server Online-Training Examen 740. Ausbildungsinhalte. ITKservice Installation, Storage and Compute with Windows Server 2016 Online-Training Examen 740 Ausbildungsinhalte ITKservice EXAM Technische Trainings Microsoft Installation, Storage and Compute with Windows Server

More information

EXCEL + POWERPOINT. Analyzing, Visualizing, and Presenting Data-Rich Insights to Any Audience KNACK TRAINING

EXCEL + POWERPOINT. Analyzing, Visualizing, and Presenting Data-Rich Insights to Any Audience KNACK TRAINING EXCEL + POWERPOINT Analyzing, Visualizing, and Presenting Data-Rich Insights to Any Audience KNACK TRAINING KEYBOARD SHORTCUTS NAVIGATION & SELECTION SHORTCUTS 3 EDITING SHORTCUTS 3 SUMMARIES PIVOT TABLES

More information

Programming Abstractions

Programming Abstractions Programming Abstractions C S 1 0 6 X Cynthia Lee This photograph was taken by Glenn Francis (User:Toglenn) and released under the license(s) stated below. You are free to use it as long as you credit me

More information

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture 04 Programs with IO and Loop We will now discuss the module 2,

More information

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Introduction History, Characteristics of Java language Java Language Basics Data types, Variables, Operators and Expressions Anatomy of a Java Program

More information

Algorithms and Programming I. Lecture#12 Spring 2015

Algorithms 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 information

Photogram. Programmable Photoshop Language Language Reference Manual. ( ), Group Leader. (

Photogram. Programmable Photoshop Language Language Reference Manual. ( ), Group Leader. ( Photogram Programmable Photoshop Language Language Reference Manual Ohan Oda Neesha Subramaniam Richard Ng Seikwon Kim ( oo2116@columbia.edu ), Group Leader ( ns2295@columbia.edu ) ( rjn2003@columbia.edu

More information

1 Getting started with Processing

1 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 information

Word for Research Writing I: Text and Structure

Word for Research Writing I: Text and Structure Word for Research Writing I: Text and Structure Last updated: 12/2017 Shari Hill Sweet dteditor@nd.edu or 631-7545 1. The Graduate School Template... 1 1.1 Document structure... 1 1.1.1 Beware of Section

More information

Microsoft Excel 2010 Handout

Microsoft Excel 2010 Handout Microsoft Excel 2010 Handout Excel is an electronic spreadsheet program you can use to enter and organize data, and perform a wide variety of number crunching tasks. Excel helps you organize and track

More information

Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller

Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller Table of Contents Introduction!... 1 Part 1: Entering Data!... 2 1.a: Typing!... 2 1.b: Editing

More information

Programming in the Real World

Programming in the Real World Programming in the Real World Ceçi n'est pas une Java import acm.program.*; public class MyProgram extends ConsoleProgram { public void run() { println("hello, world!"); } } The ACM Libraries Throughout

More information

Introduction to Java

Introduction to Java Introduction to Java Announcements Programming Assignment #1 Out: Karel the Robot: Due Friday, January 18 at 3:15 PM. Email: Due Sunday, January 20 at 11:59PM. Section assignments given out on Tuesday;

More information

The first program: Little Crab

The first program: Little Crab Chapter 2 The first program: Little Crab topics: concepts: writing code: movement, turning, reacting to the screen edges source code, method call, parameter, sequence, if-statement In the previous chapter,

More information

Decaf Language Reference Manual

Decaf Language Reference Manual Decaf Language Reference Manual C. R. Ramakrishnan Department of Computer Science SUNY at Stony Brook Stony Brook, NY 11794-4400 cram@cs.stonybrook.edu February 12, 2012 Decaf is a small object oriented

More information

Graphics Applets. By Mr. Dave Clausen

Graphics Applets. By Mr. Dave Clausen Graphics Applets By Mr. Dave Clausen Applets A Java application is a stand-alone program with a main method (like the ones we've seen so far) A Java applet is a program that is intended to transported

More information

Introducing the UML Eng. Mohammed T. Abo Alroos

Introducing the UML Eng. Mohammed T. Abo Alroos Introducing the UML Eng. Mohammed T. Abo Alroos Islamic University of Gaza Introduction to the UML: The UML stands for Unified Modeling Language. It was released in 1997 as a method to diagram software

More information