Introduction to Computing Using Java
Introduction to Computing Using Java CS 1110
Popular in Course
Popular in ComputerScienence
This 2 page Class Notes was uploaded by Lacey Collier on Saturday September 26, 2015. The Class Notes belongs to CS 1110 at Cornell University taught by D. Gries in Fall. Since its upload, it has received 66 views. For similar materials see /class/214332/cs-1110-cornell-university in ComputerScienence at Cornell University.
Reviews for Introduction to Computing Using Java
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 09/26/15
CSlllO Classa stepwise re nement 25 Sep 2008 Miscellaneous points about classes More on stepwise reli em Prelim 730900 Tuesday 30 Sept Philips 101 Review session 100300 Sunday 28 Sept Philips 101 Rsrecsh on spleilng Aoccdmig to arscheearch at Cmabirgde Uinervtisy it deosnt mttaer in waht oredr he ers in a wrod are e olny iprmoetnt tihng is hat he frsit andlsat 1tteerbe at he rghit pclae The rset can be a total mses and you can si 11 raed it wouthit porbelm Tlhs is bcuseae he huamn mnid deos not med ervey lteter by istlef but he wrod as a wlohe Help Get it now if you need itll Oneonone help from TAs For info get on the course website and click quotStaffinfoquot Call Cindy Pakkala 2558240 for an appointment with Gries See a consultant in the ACCEL Sun Mon Tues Wed Thum 400pm to 1100pm Peertutoring free On httpMMMengineering ornelledu click on quotstudent servicesquot On the page that comes up click on quotEngineering Learning Initiatives ELL in upper parl Then click on quotpeertutoringquot in the lefl column Take an AEW courses Ask in Olin 167 Content of this lecture your knowledge of classes and subclasses There are a few more things to learn afler this bul we will handle them much later I Inheritirlg elds and methods and overriding methods pp 144445 one constructor in a class another use of this sec 31 3 pp 1107112 I Constructom in a subclass 7 calling a constructor of the superclass sec 413 pp 1477148 Employee c new Ernployee Griesquot 1959 50000 sec 41 c toStringo page 142 c a0 a0 39ch method ostrirbgo A is called equalsC7bJect tosmngo able Overridng rule or my 50000 00 Employee bottomup rule To nd out which is used an at the bottom of the class and search upward until a matching one is found name Ones start 1959 getNameO setNames 39nng n saingo This class is on page 105 of the text Terminology Employee inherits methods and elds from Object Employee overrides function toString Purpose of super and this Sec 41 pages A second constructor in Employee sec 31 3 this re ers o the name of the object in which it appears 144 5 vaide tlexi ility ease ofuse to user Page no r m String representation of his equalsDbJect 001w Emplo ee Los mgo public String csmngo return 39sgetNameO yearquot name Gnep Employee tan ts 1 quot 1 ge o sa ary sa ary WY 50000 00 olr but unnecessary mm 1959 i csmng value from superclass ge Nameo blic String csmngUpo setNames nng n return super toSmngO 390 Smngo 39 mSmngUpo l necessary public Employee String n int d double 5 name n t salary LC0 s tructor a person with name n year hired d salary s irst bonstructor n rructor a person with name n year hired d salary 50 000 bli Em l Stai 39 t d Punarcn ytaer d aglanry 50000 S Emmi 39 39 39 salary is always 50000 Constructor a person with name n year hired d salary 50 000 P quotquot E39quotP Yeesmquotg quot d Another version of second 115 d 50000 constructor calls li39rst constructor Here this refers to the other constructor YouHAVEto do it this my public class Eccenn39ve extends Employee Calling it supemlass Anglicth m 1mg pm39vatc double bonus comma m 1 H H WOO mm hi d subclass constructor anQIICIZe 1 5 one ns nnamenyem re l n d salaryso 000 bonus I 3 5 39339 I 7 angle 15 39s quot eequot we Execudvds n in double b 00 angllclze 123quot Is one hundred twenty threequot P sure n quot g LoStnngO 6 anglicize 10570quot is tenthousandfive hundred seventyquot benns 1 my 50000 Employee the anglicization of n Precondltmn 0 lt n lt 1000000 I name Grief start 1959 public static String anglicizeint n The rst and only the rst statement in EmployeeGmng m0 2 quot 5 390 be 2 1quot 2 tesmngo getCompensauono c nmnctmof e superclzss1fyou n t put one in then this one bonus 10000 Executive automancally used IMO ExecuuveGmng mt double getEcnuso getCompensaacno Principle Fill in superclass elds rst bsmngO 7 Principles and strategies Develop algorithm step by step using pn39nciples and strategies embodied in stepwise re nementquot 39 READ or toprdown programmlng Sec 2 s andPliVep 275 Take small ste s Replace an English statement what to do by a sequence of statements fin English or Java7 to do it how to do c 39le often development until later IVla ana means tom now or an inde nite tim e in the futur
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'