Java OOP GUIDES / WORK Basic Objects – Instance variables –
Instance methods – Constructors – Encapsulation – Object arrays – Aggregation SHORT ANSWER QUESTIONS
GUIDES / TASKS
+++++ In Dog class,
or as Dog class 2, add a rollover and an age check. If too old, then dog doesn’t roll
over. This would show more use of
instance variables. +++++ Simple intro
class similar to Dog public class
HardDrive { public void writeData() { System.out.println(“data is being
written”); } public void readData() { System.out.println(“data is being
read from hard drive”); } } public class Computer { public static void main(String[]args) { HardDisk segate= new HardDisk(); segate.writedata(); } } +++++ Object array
idea. Students get
a Point class and a Line class as starter code. Students are
also given code to create a Point array. Students are
to write a function that will get a point array and create a Line array where
the lines are the lines between each point including the line from the last
point to the first point. Can also
write a function that will translate all points in an array. +++++ Pass by
reference for objects Pass by
reference for datafields (Security risk when datafields are references.) +++++ Array as a
datafield. (String chooser problem
from AP 2016 test?) (Or, a Sequence
class that holds an array with a sequence.
It has a getNext() method and perhaps a hasNext() method. And a getAt() method. Also a getPrev() and hasPrev(). And just a getCurrent() method. +++++ Point class
with Point() constructor that generates points within a certain distance of
origin. Create many and draw them
using NOOPDraw. Then include a translate
method that moves points to a more central location on the screen to make out
the shape of the circle. +++++ Possibly do a
turtle graphics application using NOOPDraw? +++++ Possible idea Couple which
needs two Persons. Couple can
haveChild() which returns a new Person.
We can put all Persons in a family maybe? Arraylist?
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|