7 Million Study Materials
From students who've taken these classes before
24/7 Access to Tutors
Personal attention for all your questions
Learn
93% of our members earn better grades
Cornell | CS 1130
Transition To Object-Oriented
Professors
  • D Gries,
  • Gries,d (djg17),,
  • ,
  • David Gries,
  • Walker White
 
 
 

100 sample documents related to CS 1130

  • Cornell CS 1130
    Monitoring Rhinos The rhinoceros population is endangered, having declined 90 percent since 1970, with only five species remaining the world today. The white and black rhinos are the only species left in Africa. Much of the threat to the rhinoceros comes
     
  • Cornell CS 1130
    Diagraming Objects and Frames This is a simple written assignment where you are going to diagram a few objects. It should not take more a few minutes do to this assignment. So even if you are busy revising assignment 1, you should be able to do this assig
     
  • Cornell CS 1130
    J*Man In this assignment, you will create a simple video game called J*Man. In this game, the player uses buttons to steer the star-like J*Man around a board, capturing other pieces. The assignment will give you more experience with the structure of objec
     
  • Cornell CS 1130
    CS1130 Lab 06 Spring 2012 Exception Handling 1 This lab concerns exception handling. It is optional, and you do not have to show it to your TA, but the material is on the final. This Lab will be easier if you did the reading on exception handling, Chapt
     
  • Cornell CS 1130
    1 /9/12 CS1130, Lab 06. Reading les CS1130 Name _ Lab 05. Reading files Spring 2012 NetId _ This lab discusses input reading a file. After the lab, study section 5.9 of the text. Better yet, listen to the lectures on lesson p age 5 -7 of the ProgramLive C
     
  • Cornell CS 1130
    CS 1130, LAB 4: ABSTRACT CLASSES Name: Net-ID: There is an online version of these instructions at http:/www.cs.cornell.edu/courses/cs1130 You may wish to use that version of the instructions. This lab introduces you to the useful software-engineering con
     
  • Cornell CS 1130
    CS 1130, LAB 3: VECTOR EXERCISES Name: Net-ID: There is an online version of these instructions at http:/www.cs.cornell.edu/courses/cs1130 You may wish to use that version of the instructions. Class java.util.Vector provides the ability to maintain a grow
     
  • Cornell CS 1130
    CS 1130, LAB 2: CLASSES, METHODS, AND TESTING Net-ID: Name: There is an online version of these instructions at http:/www.cs.cornell.edu/courses/cs1130 You may wish to use that version of the instructions. The purpose of this lab is to get you used to wri
     
  • Cornell CS 1130
    CS 1130, LAB 1: WORKING WITH THE JAVA API Name: Net-ID: There is an online version of these instructions at http:/www.cs.cornell.edu/courses/cs1130 You may wish to use that version of the instructions. The purpose of this lab is to get you comfortable wit
     
  • Cornell CS 1130
    CS 1130, LAB 0: JAVA EXPRESSIONS Name: Net-ID: There is an online version of these instructions at http:/www.cs.cornell.edu/courses/cs1130/ You may wish to use that version of the instructions. This lab serves two purposes. First, it is designed to get yo
     
  • Cornell CS 1130
    #2# # ComputerVirus#java/lang/Object#name#Ljava/lang/String;#type#C#month# #I#year#predecessor#LComputerVirus;# variation#id#<init>#(Ljava/lang/String;IIC)V#Code # #()V # # # # # # # # # # #LineNumberTable#LocalVariableTable#this#Name1#Month1#Year1#Type1
     
  • Cornell CS 1130
    /Ilookedcarefullyatthespecificationsproducedbyclickingthejavadocbuttonand checkedthatthespecificationsofmethodsandtheclassspecificationwereOK /*aninstancemaintainsinfoaboutavirus*/ publicclassComputerViruscfw_ privateStringname;/thevirusname privatecharty
     
  • Cornell CS 1130
    #2#v#ComputerVirusTester#junit/framework/TestCase#<init>#()V# Code # #LineNumberTable#LocalVariableTable#this#LComputerVirusTester;#testfi rstConstructorGetters#ComputerVirus#hopper # #(Ljava/lang/String;IIC)V # #getName#()Ljava/lang/String; # # assertEqu
     
  • Cornell CS 1130
    import junit.framework.TestCase; /* * A JUnit test case class. * Every method starting with the word \"test\" will be called when running * the test with JUnit. */ public class ComputerVirusTester extends TestCase cfw_ /* * A test method. * (Replace \"X\" wit
     
  • Cornell CS 1130
    #2#w#Rhino#java/lang/Object#name#Ljava/lang/String;#gender# C#month#I#year#tag#father#LRhino;#mother#children#<init>#(Ljava /lang/String;IIC)V#Code # #()V # # # # # # # # # # # # #LineNumberTable#LocalVariableTable#this#\'(Ljava/lang/String;IICLRhino;LRhin
     
  • Cornell CS 1130
    /* I looked carefully at the specifications produced by clicking the javadoc button and * checked that the specifications of methods and the class specification were OK */ /* This is a class representing rhinos*/ public class Rhino cfw_ private private pr
     
  • Cornell CS 1130
    #2#t#RhinoTester#junit/framework/TestCase#<init>#()V#Code # #LineNumberTable#LocalVariableTable#this# LRhinoTester;#testConstructer1_Getters#Rhino#Love # #(Ljava/lang/String;IIC)V # #getName#()Ljava/lang/String; # # assertEquals#\'(Ljava/lang/String;Ljava/
     
  • Cornell CS 1130
    import junit.framework.TestCase; /* * A JUnit test case class. * Every method starting with the word \"test\" will be called when running * the test with JUnit. */ public class RhinoTester extends TestCase cfw_ public void testConstructer1_Getters() cfw_ Rh
     
  • Cornell CS 1130
    import java.awt.*; /* An instance of this class is a Block. Blocks cannot move.*/ public class Block extends Piece cfw_ /* Constructor: a new Block at position (x, y) on Map m with color white. */ public Block(int x, int y, int c, Map m)cfw_ super(Piece.B
     
  • Cornell CS 1130
    /* An instance of class ComputerVirus represents a computer virus * I used the javadoc buttons to check that the specifications of methods and class specifications were ok. */ public class ComputerViruscfw_ private String name; /Virus\'s name private char
     
  • Cornell CS 1130
    import junit.framework.TestCase; /* A JUnit test case class. * Every method starting with the word \"test\" will be called when running the test with JUnit. */ public class ComputerVirusTester extends TestCasecfw_ /* A test method. * (Replace \"X\" with a nam
     
  • Cornell CS 1130
    import java.awt.*; /* An instance of this class is a J*Man. There should at most one J*Man in a game board at a time*/ public class JMan extends Piece cfw_ /* Constructor: a new J*Man at position (x, y) on Map m with color red if c = 0, green if c = 1, an
     
  • Map
    Cornell CS 1130
    import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Map implements ActionListenercfw_ / Window for game with graphics and buttons. public JFrame frame= new JFrame(\"J*Man!\"); / The GUI window / The board of the game. Class JManPa
     
  • Cornell CS 1130
    import java.awt.*; /* An instance is a piece for use in the J*Man! assignment 2.*/ public abstract class Piececfw_ /* Constants that identify the kind of a piece. */ public static final int BLOCK= 0; / piece is a block public static final int JMAN= 1; / p
     
  • Cornell CS 1130
    import java.awt.*; /* An instance of this class is a Pillar.*/ public class Pillar extends Piece cfw_ /* Constructor: a new Pillar at position (x, y) on Map m with color red if c = 0, green if c = 1, and yellow if c = 2. */ public Pillar(int x, int y, int
     
  • Cornell CS 1130
    import java.awt.*; /* An instance of this class is a J*Man. There should at most one J*Man in a game board at a time*/ public class Walker extends Piece cfw_ /* Constructor: a new Walker at position (x, y) on Map m with color red if c = 0, green if c = 1,
     
  • Cornell CS 1130
    #1#e #K #L #M #N # #K # #T#U # #V#W # #X#Y#Z#[#\\ # #O #P #Q #R#S #]#^#_#name#Ljava/lang/String;#type#C#monthofDiscovery#I#idNumber# #yearofDiscovery#predecessor#LComputerVirus;#numberofVariations#<init>#(L java/lang/String;IIC)V#Code#LineNumberTable#Local
     
  • Cornell CS 1130
    /* An instance of class ComputerVirus represents a single computer virus. * It has several fields that one might use to describe a computer virus, * as well as methods that operate on these fields.*/ public class ComputerVirus cfw_ private String name; pr
     
  • Cornell CS 1130
    /* An instance of class ComputerVirus represents a single computer virus. * It has several fields that one might use to describe a computer virus, * as well as methods that operate on these fields.*/ public class ComputerVirus cfw_ private String name; pr
     
  • Cornell CS 1130
    import junit.framework.TestCase; /* * A JUnit test case class. * Every method starting with the word \"test\" will be called when running * the test with JUnit. */ public class ComputervirusTester extends TestCase cfw_ /* * A test method. * (Replace \"X\" wit
     
  • Cornell CS 1130
    import junit.framework.TestCase; /* * A JUnit test case class. * Every method starting with the word \"test\" will be called when running * the test with JUnit. */ public class ComputervirusTester extends TestCase cfw_ /* * A test method. * (Replace \"X\" wit
     
  • AP1
    Cornell CS 1130
    # .#1Jdd#expo_diff# # #expo_using# # #expo_structure# #t#(#@#@# # # #f3#33 # 3f# 3#3#f#3#T1 #www#UUU#\"# # # # # # # # #
     
  • AP2
    Cornell CS 1130
    #l#1Jdd#tagexpo#d#apptagexpo# #D #( #(#@#.#f #333#33# #w ww#\"# # # # # # # # # # # #
     
  • AP3
    Cornell CS 1130
    #1Jdd#expo_clock#d# #expo_sum# # #(#@#@# #s #f #s 4 #f H # 3#3#f3#4f3#ff3#f33#333#f# f#ff#f3#33#\"#www#DDD# # # # # # # # # # # #
     
  • Cornell CS 1130
    #| I#x2dd#tab# #hello1# #t#x,#helnet#o#(#3# # #(#p#d# #$#h#^ # #\'X#f3 #33X# f#fA f#off# 3f#f3f#3#f#f33# #3#f#3#3#3#f3# #f#3#\'X #www#\"# #\"# # # # # # # # # # # # # # # # # # # # # # # # # # # \"# # #
     
  • Cornell CS 1130
    #t6#x2dd#tab#helnet# #t# #windowex#pt#(# #3# # #(#h# #6#f#3#h# #f#3#6#f# # # #.# # #f# # F#f #3 ## f#ff#3f#f#33#f# f#ff#f# f#jf#ff# f#f#jf#fxf#3f#Ff#ff#ff#ff#fff#3ff#ff#f3f#33f#f#f#3#f#f# 3# f3#f3#f3# f3#ff3#3f3#f3#33#F33#f33#333#33#3#f#3#3#3#3#l#f #Bf#ff
     
  • Cornell CS 1130
    #j#$cdd#clock1#d# D#clock2# #E# %#(#0#^# #K #ff#3f# #f#f#aj#f #ff# #m# #E#: #u# f #3f#f#f #f# f#f# f#3f#ff#fff#3ff#ff#3f#K3#f3#33#3#f3# 3#3# 3#f3# 3#f 3#f3# f3#ff3#3f3#f3# 33#f33#333#33#f#3# #f#f# f#ff# 3#f3#33# 3#3#\"#\"#D#\"#:#www#UUU#DDD#\"# #] ] ] ] ]
     
  • Cornell CS 1130
    #x2dd#html1#8# #(# #5#3f#f0# # #6#f #6# #S. # f#f# # f#ff#ff#ff#fff# 3# 3#f3#ff3#f33#333# #6# #f#33# # #f# Gx#www#UUU#DDD#\"#4444444444444444444444 44444444444444444444444444444444444444444444444444444444444444444444444444444444444 444444444444444444444444
     
  • Cornell CS 1130
    #DY#x2dd#APhello# #APhellf1#l#Xg#APhellf2# #\\#@~#APhellf3#@~#(# #N# #ff#3f#f#f#)#f #ff# #J# #f #gJ# #fC# fY#f#f#gf#pf#f#ff#fff#3ff#ff#3f#)3#f3# 33#f3#3# 3#3#fJ3#K3#f3#f3# f3#ff3#f3#h33#f33#333#33#f#3# #C# #f#Jf#ff# 3#f3#33#3#J #www#UUU#DDD#\"#MMMMMMMM MMMM
     
  • Cornell CS 1130
    #H5#$cdd#apsum0#c# #apjdial1#@# #apjdial2# #DT# #(#N# #ff#3f# #f# #f# #f#ff# p#f# # #f< # f*#f#f# f#f# f#ff#fff#3ff#ff#3f# 3#f3#33#f3#3#3# 3#f3#3#f3#f3#<f3#ff3# #f3#33#f33#333#33#f#3#5# #f#f#ff#3#f3#33#3# #b#www#UUU#DDD#\"#MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
     
  • Cornell CS 1130
    import import import import i import java.awt.*; java.util.*; java.text.*; java.applet.*; javax.swing.*; / An applet that displays a clock with the time / at which the instance was created and the time / whenever it is repainted public class Clock extends
     
  • Cornell CS 1130
    import import import i import java.awt.*; java.util.*; java.applet.*; javax.swing.*; / An applet that requests two double values from the user / and prints their sum public class Summing extends JApplet cfw_ private double sum; / the sum of the two values
     
  • Cornell CS 1130
    XX=Program Live
     
  • Cornell CS 1130
    PGL=ProgramLive
     
  • Cornell CS 1130
    group=Introductionlesson=Introduction to livetexts directory=IN file=IN1 page=Introduction to livetexts expo=Exploring this book of lessons of this lesson book INPage.exp file=IN2 page=Activities expo=Using controls in activities INActiv.exp quiz=Introduc
     
  • Cornell CS 1130
    #1Jdd#activities#X#h#assistant# # #asterisk#$#folders# #H#labs#@#l#control_bar# #exercise#t# #help_guide#@5#homework#\\ #project#\"#speaker# #(#two-way# 7#uniform# W#folder#\\# #control_bar@#e# #help_guide@#z#1#object1# #8m#flawchart#4#Hw#triangle# #X#&#coor
     
  • Cornell CS 1130
    := for assignment 199_xxassign.ast= for assignment 199_xxassign.astabs -1 310abstract class -1 440 499_pgl01004.lababstract class vs. interface 1200abstract method -1 440abstraction -1 231accessibility 99_xxaccess.astACM -1 199_xxlangh3.astacos -1 310Acti
     
  • Cornell CS 1130
    Tired of looking at the same old spiral on the left-hand side of the Lesson Book? Try a leather-bound book format! Choose <b>Preferences</b> from the <b>Edit</b> menu and select from the <b>Lesson Book Format</b> field.</p>If the text on the Lesson Book a
     
  • Cornell CS 1130
    /Region public class Regioncfw_ private String name;/name of the region private int area;/area of the region public Region(String s, int a)cfw_ name=s; area=a; public String toString()cfw_ return name+\" has area \"+area+\" sq miles\";
     
  • Cornell CS 1130
    import junit.framework.TestCase; /* * A JUnit test case class. * Every method starting with the word \"test\" will be called when running * the test with JUnit. */ public class RegionTester extends TestCase cfw_ /* * A test method. * (Replace \"X\" with a nam
     
  • Cornell CS 1130
    /SubRegion import java.util.Vector; public class SubRegion extends Regioncfw_ private Vector<Region> constituents=null;/makes a null vector public SubRegion(String s, int a, Vector<Region> r)cfw_ super(s,a); constituents=r; public int getPopulation()cfw_
     
  • Cornell CS 1130
    import junit.framework.TestCase; import java.util.*; /* * A JUnit test case class. * Every method starting with the word \"test\" will be called when running * the test with JUnit. */ public class SubRegionTester extends TestCase cfw_ /* * A test method. *
     
  • Cornell CS 1130
    /Town public class Town extends Regioncfw_ private int pop;/variable for population of the town public Town(String s, int a, int p)cfw_ super(s,a); pop=p; public int getPopulation()cfw_ return pop; public void setPopulation(int p)cfw_ pop=p; public Str
     
  • Cornell CS 1130
    import junit.framework.TestCase; /* * A JUnit test case class. * Every method starting with the word \"test\" will be called when running * the test with JUnit. */ public class TownTester extends TestCase cfw_ /* * A test method. * (Replace \"X\" with a name
     
  • Cornell CS 1130
    #2# #D# # # # #?PbM# # # # # # # # # # # # # # #@$#?@bM #C# #@Y#?tzG#cfw_#?s # # # #0# #0# #0# #0# #<# #<# #<# #C#@o# # #0# # #@N#@v #@^#@n# #<# #<# #<# #<# # # #<init>#()V#Code#LineNumberTable#LocalVariableTable#this#LA4Metho ds;# complementRGB#\"(Ljava/a
     
  • Cornell CS 1130
    /Ispent8hoursonthisassignment. importjava.awt.*; /*ContainsstaticmethodsofassignmentA4*/ publicclassA4Methodscfw_ /*=thecomplementofcolorrgb.*/ publicstaticColorcomplementRGB(Colorrgb)cfw_ returnnewColor(255rgb.getRed(),255rgb.getGreen(),255rgb.getBlue();
     
  • Cornell CS 1130
    importjava.awt.*; /*ContainsstaticmethodsofassignmentA4*/ publicclassA4Methodscfw_ /*=thecomplementofcolorrgb.*/ publicstaticColorcomplementRGB(Colorrgb)cfw_ returnnewColor(255rgb.getRed(),255rgb.getGreen(),255rgb.getBlue(); /*=d,asaString,usingexactly5c
     
  • Cornell CS 1130
    #2#* # # # # #@`RG#cfw_ # # #@`QG#z#@Y#@X9X#bN#@X\\(a#@X#zH#@5x#@5v 9X#@$#@#@$#*#@# r#@#?#?q #? U:=#?X#e+#?1 # o#?v#;#?UL _# #?:6#C-#?Pas\'? # # # #G# #?v9X#?E#?+# I^#?S# #T# #@p# +# #?S#?3& z # # #G# #G# #G# #G# # #T# #T#?#zG#?#zG#?Q #R # # # #?#@DQ #R#? =
     
  • Cornell CS 1130
    import junit.framework.TestCase; import java.awt.*; /* * A JUnit test case class. * Every method starting with the word \"test\" will be called when running * the test with JUnit. */ p public class A4Tester extends TestCase cfw_ /* Test complement */ public
     
  • Cornell CS 1130
    import junit.framework.TestCase; import java.awt.*; /* * A JUnit test case class. * Every method starting with the word \"test\" will be called when running * the test with JUnit. */ p public class A4Tester extends TestCase cfw_ /* Test complement */ public
     
  • Cornell CS 1130
    #2#E #) #* #+ #, #.#/ #.#0#1 #)#2 #3#4 #5 #6 #7#8#9#:#;#c#D#m#y#k#<init>#(DDDD)V#Code#LineNumberTable# LocalVariableTable#this#LCMYK;#truncate#)Ljava/lang/Stri ng;#s#Ljava/lang/String;#StackMapTable#toString#()Ljava/lang/String;# Sourc
     
  • Cornell CS 1130
    /*AninstancerepresentsaCMYKvalue*/ publicclassCMYKcfw_ /*Colorcyan.0c1.*/ publicdoublec; /*Colormagenta.0m1.*/ publicdoublem; /*Coloryellow.0y1.*/ publicdoubley; /*Colorblack.0c1.*/ publicdoublek; /*Constructor:theCMYKvalue(c,m,y,k). Precondition:Allcompo
     
  • Cornell CS 1130
    /*AninstancerepresentsaCMYKvalue*/ publicclassCMYKcfw_ /*Colorcyan.0c1.*/ publicdoublec; /*Colormagenta.0m1.*/ publicdoublem; /*Coloryellow.0y1.*/ publicdoubley; /*Colorblack.0c1.*/ publicdoublek; /*Constructor:theCMYKvalue(c,m,y,k). Precondition:Allcompo
     
  • HSV
    Cornell CS 1130
    #2##h#D#s#v#<init>#(DDD)V#Code#LineNumberTable#LocalVariableTable #this#LHSV;#getHue#()D#getSaturation# getBrightness#toString#()Ljava/lang/String;# SourceFile#HSV.java # # # # # # #$ #%#HSV#java/lang/Object#()V# # # # # # A4Methods#(LHSV
     
  • HSV
    Cornell CS 1130
    /*AninstanceisanHSVvalue.*/ publicclassHSVcfw_ /*h,s,andvarethecomponentsofanHSVvalue*/ /*Thehue.0h<360.*/ publicdoubleh; /*Thesaturation.0s1.*/ publicdoubles; /*Thevalue,orbrightness.0v1.*/ publicdoublev; /*Constructor:theHSVcolor(h,s,v). Precondition:0h
     
  • HSV
    Cornell CS 1130
    /*AninstanceisanHSVvalue.*/ publicclassHSVcfw_ /*h,s,andvarethecomponentsofanHSVvalue*/ /*Thehue.0h<360.*/ publicdoubleh; /*Thesaturation.0s1.*/ publicdoubles; /*Thevalue,orbrightness.0v1.*/ publicdoublev; /*Constructor:theHSVcolor(h,s,v). Precondition:0h
     
  • HSV
    Cornell CS 1130
    #1#n #3#\\#@v # #1#] #1#^ #1#_#` #\\#a #b #1#c#d#e #f#?PbM#g #h#i #j#k#@Y#?V N #1#l#@$#?tzG#cfw_#?@bM#@N# #m#n#o#@o# #m#p #q #r #s #t #m#u #m#v#@^#@n#w #1#x#y#h#D#s#v#<init>#(DDD)V#Code#LineNumberTable#LocalVariableT able#this#LHSV;#toString#()Ljava/lang/St
     
  • Cornell CS 1130
    #1#] #. #/ #+#0 #+#1 #+#2 #3#4 #5#6 #3#7 #+#8 #+#9 #3#: #+#; #<#= #+#>#? #@#A#this$0#LTurtle;#<init>#(LTurtle;)V#Code#LineNumberTable#LocalV ariableTable#this# InnerClasses# LTurtle$1;# mouseClicked#(Ljava/awt/event/MouseEvent;)V#me#Ljava/awt/event/MouseE
     
  • Cornell CS 1130
    #1#@ # #! #\" #$ #%##<init>#(LTurtle;)V#Code#LineNumberTable#LocalVariabl eTable#this#Clear# InnerClasses#LTurtle$Clear;#exec#(Ljava/awt/Graphics;)V#g#Ljava/awt/Graph ics;#save#Ljava/awt/Color;#toString#()Ljava/lang/Strin
     
  • Cornell CS 1130
    #1#G #* #+ #, #. #/ #0 #1#2 #1#3 #1#4#5 # #6#8#9#this$0#LTurtle;#<init>#(LTurtle;IIIILjava/awt/Color;)V#Code#Li neNumberTable#LocalVariableTable#this#FillOvalCommand# InnerClasses#LTurtle$FillOvalCommand;#x1#I#y1#x2#y2#c#Ljava/awt/Col or;#exec#(Ljava/awt/
     
  • Cornell CS 1130
    #1#G #* #+ #, #. #/ #0 #1#2 #1#3 #1#4#5 # #6#8#9#this$0#LTurtle;#<init>#(LTurtle;IIIILjava/awt/Color;)V#Code#Li neNumberTable#LocalVariableTable#this#FillRectCommand# InnerClasses#LTurtle$FillRectCommand;#x1#I#y1#x2#y2#c#Ljava/awt/Col or;#exec#(Ljava/awt/
     
  • Cornell CS 1130
    #1#B # ##<init>#(LTurtle; [I[ILjava/awt/Color;)V#Code#LineNumberTable#LocalVariableTable#this#FillT riangleCommand# InnerClasses#LTurtle$FillTriangleCommand;#c#Ljava/awt/Color;#exec#(Ljava/ aw
     
  • Cornell CS 1130
    #1#@ #\' # #( #)#* #)#+ #,#. #)#/#0#1#2#this$0#LTurtle;#<init>#(LTurtle;Ljava/lang/String;)V#Code# #LineNumberTable#LocalVariableTable#this#JFramePaint# InnerClasses#LTurtle$JFramePaint;#t#Ljava/lang/String;#paint#(Ljava/awt/G raphics;)V#i#I#g#Ljava/awt/Gr
     
  • Cornell CS 1130
    #1#H #0 #1 #2#3 #2 #4#5 #6 #7#8 #9 #: #;#< #=#? #@#x1#I#y1#x2#y2#c#Ljava/awt/Color;#this$0#LTurtle;#<init>#( LTurtle;)V#Code#LineNumberTable#LocalVariableTable#this# PaintCommand# InnerClasses#LTurtle$PaintCommand;#exec#(Ljava/awt/Graphics;)V#toString#&(
     
  • Cornell CS 1130
    #1#G #* #+ #, #. #/ #0 #1#2 #1#3 #1#4#5 # #6#8#9#this$0#LTurtle;#<init>#(LTurtle;IIIILjava/awt/Color;)V#Code#Li neNumberTable#LocalVariableTable#this#PaintLineCommand# InnerClasses#LTurtle$PaintLineCommand;#x1#I#y1#x2#y2#c#Ljava/awt/Co lor;#exec#(Ljava/aw
     
  • Cornell CS 1130
    Types and type int A type is a set of values together with the (primitive) operations on them. Memorize this definition! The term will be used over and over again when dealing with Java. Type integer is used frequently in mathematics, the sciences, a
     
  • Cornell CS 1130
    Class ArrayList a0 0 a1 1 a4 2 a2 3 a9 a2 Chem209 a9 FWS001 String String ArrayList a1 CS100M a4 Math193 String String a0 0 a1 1 a4 2 a2 . . . 364 a9 Class ArrayList a1 ArrayList a4 10 a2 15 a9 25 Integer Integer Integer -5 Integer An instance cont
     
  • Cornell CS 1130
    Wrapper class Integer a0 ? intValue() byteValue() shortValue() longValue() oatValue() doubleValue() toString() equals(Object) The int eld cant be changed it is immutable. /* = ob is a class Integer object, and its wrapped value equals this objects wr
     
  • Cornell CS 1130
    Specifications of methods You know what the first function mini does, because its specification, in the comment preceding it, tells you. You dont need the function body which we show you now. You have no idea what the second function does, because it
     
  • Cornell CS 1130
    File drawers objects Format of a manila folder object name fields class a0 name address owes Each folder in drawer Patient contains the same kind of information. class manila folder file drawer object instance field class mani
     
  • Cornell CS 1130
    Executing method calls Why learn how a method call is executed? Gives you a better understanding of how a Java program is executed. You may have to execute a method call by hand during debugging. Knowledge of how a call is executed can help in ana
     
  • Cornell CS 1130
    Assignment statement Form of the assignment statement <variable>= <expression>; How to execute, or carry out, an assignment Evaluate the <expression> and store its value in the <variable>. Initializing declaration Form of initializing declaration, a
     
  • Cornell CS 1130
    Variables and declarations A variable is a name with an associated value. Throughout this course, we draw a variable as a named box with the value in the box. For example, here is a variable x associated with the value 5. Sometimes, we draw a line in
     
  • Cornell CS 1130
    Local variables Local variable: A variable declared in a method body. /* = smallest of x, y, and z */ public void m(int x, int y, int z) { if (x > y) { / Swap x and y. int temp; temp= x; x= y; y= temp; } Chapter if (x > y) { / Swap x and z. int temp;
     
  • Cornell CS 1130
    Constrained ArrayLists a0 0 a1 1 a4 2 a2 ArrayList Object a0 String 0 a1 1 a4 Constrained ArrayLists ArrayList Integer Integer Integer a1 CS100M a4 Object Object a1 0 a4 7 a2 Integer Integer 5 a2 . Integer 2 a2 JFrame b a0 -5 Integer Each
     
  • Cornell CS 1130
    Types and component references A class is also a type Method calls A class is also a type Patient: a type (as well as a class) Values: names appearing in tabs of objects Operations: none x 25 int y 7 int p ? a0 Patient Patient: a type (as well as
     
  • Cornell CS 1130
    Specifications of methods What do the two methods mini do? /* Return s but with all blanks removed and all capitals changed to lowercase. */ public static String mini(String s){ s= s.replace( , ); return s.toLowerCase(); } public static int mini(int
     
  • Cornell CS 1130
    Computer Science 1130 Transition to OO Programming Spring 2009 Contract The purpose of this contract is for you to set a realistic goal for yourself for completion of the material in CS1130. The course should require the amount of work in the first f
     
  • Cornell CS 1130
    Apparent and real classes a0 equals(Object) toString() a0 equals(Object) toString() Apparent class Object Shape Object ob; Shape sp; Circle ci; Object Shape Object ob; Shape sp; Circle ci; x 20 y 30 x 20 y 30 Shape() Shape(int, int) getX() g
     
  • Cornell CS 1130
    The class invariant The class invariant public class TimeOfDay { private int time= 0; private String zone= \"GMT\"; private boolean ampm= false; public TimeOfDay() 0 GMT in 24-hr time 2:30PM or 14:30 public TimeOfDay(sec, zone) public TimeOfDay(hrs, mi
     
  • Cornell CS 1130
    The subclass definition The manila folder for subclass Demo Here is a manilla folder an object or instance of class JFrame. The tab contains the name of the folder, the name of the class appear in the upper right, and we show only some of the methods
     
  • Cornell CS 1130
    Function equals public class Object { /* = \"This object and object ob are the same object\". */ public boolean equals(Object ob) { return this = ob; } } Overriding function equals a0 Object equals(Object) C equals(Object) a0 Object equals(Object)
     
  • Cornell CS 1130
    An instance of class Chapter a0 number title 0 null Chapter An instance of class Chapter a0 number title 0 null Chapter getNumber() getTitle() setNumber(int) setTitle(String) Variable declared in a class: field, or instance variable access modifie
     
  • Cornell CS 1130
    An instance of class Chapter a0 number title null 0 prev Chapter null a0 number title null 0 The constructor Chapter prev null getNumber() getTitle() getPrev() setNumber(int) setTitle(String) getNumber() getTitle() getPrev() setNumber(int) setTit
     
  • Cornell CS 1130
    Functions toString and equals in class Object Function toString in class Object Function toString in class Object is defined to return the name of the manilla folder, or object in which it appears. For example, evaluate this expression in DrJavas int
     
  • Cornell CS 1130
    Calling constructors from constructors a0 equals(Object) toString() Calling constructors from constructors a0 Object Shape Object Shape equals(Object) toString() x 20 y 30 x 20 y 30 Shape() Shape(int, int) getX() getY() toString() (x, y)
     
  • Cornell CS 1130
    The inside-out rule Caveat about respecting privacy We show a rule for determining which variable declaration a variable reference is associated with. This issue is independent of whether that variable can be accessed. The inside-out rule variable
     
  • Cornell CS 1130
    Answers to self-help exercise including a partition for class Object when drawing an object b1 equals(Object) toString() Object b2 equals(Object) toString() Object Ex h _3_ Ex(int) getH() toString() Ex h _3_ Ex(int) getH() toString() Sub k_6_ Su
     
  • Cornell CS 1130
    Function toString Function toString for class Chapter In the DrJava right upper pane, you see class Chapter, with three fields: the chapter number, chapter title, and the previous chapter. Along with two constructors and getter/setter methods. We oft
     
  • Cornell CS 1130
    Wrapper classes An instance of class Integer contains a field of type int. We haven\'t given the name of the field because we don\'t know it. But there is a getter method for it, intValue(). In fact, one can obtain the int value as a primitive value of
     
 
 
 
 
7,000,000 study materials • 24/7 tutors • earn better grades
Ask a tutor a question for CS 1130
 
* 
Browse...