AP Computer Science Homework Set 10 Classes and Constructor
AP Computer Science Homework Set 10 Classes and Constructor
AP Computer Science Homework Set 10 Classes and Constructor
- No tags were found...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Write the class definition for the MyPod class. The class should include thefollowing:a. a String that holds the color of the MyPod along with setters <strong>and</strong> getters for theString variable.b. A zero-argument <strong>and</strong> one-argument constructor. The one-argument constructorshould take a String parameter to initialize the color of the MyPod.c. a static int serialNumber that is incremented when a new instance of a MyPodobject is instantiated from either a zero-argument or one-argument constructor.d. a final static PARTNUMBER that is initialized to the int 9876 along with agetter for this variable.P<strong>10</strong>B. Fun with Autoboxing! The “Big Five” rules for autoboxing on page 290 aregood to know. Write a short program that demonstrates each of these rules.P<strong>10</strong>C.Use the Calendar method getTimeInMillis() to time how long it takes to create<strong>and</strong> fill a <strong>10</strong>00 element array with r<strong>and</strong>om numbers between 1 <strong>and</strong> <strong>10</strong>0 <strong>and</strong> anArrayList of Integers filled with r<strong>and</strong>om numbers between 1 <strong>and</strong> <strong>10</strong>0. Which do youthink is faster?P<strong>10</strong>E.P<strong>10</strong>F.codingbatcodingbatPage 2<strong>AP</strong> <strong>Computer</strong> <strong>Science</strong> – HW <strong>Set</strong> <strong>10</strong>http://thecubscientist.com