10.6. EXERCISES 175
- RedotheregressionproblemfromChapter8 usingaRegressionclass.Yournewclasswillkeep
trackofthevariousquantitiesthatareneededtocomputea lineofregresion(therunningsumsofx,y,
x^2 andxy)Theregressionclassshouldhave thefollowingmethods.
init Createsa new regressionobjecttowhichpointscanbeadded.
addPointAddsa pointtotheregressionobject.
predictAcceptsa valueofxasa parameter, andreturnsthevalueofthecorrespondingyontheline
ofbestfit.
Note:Yourclassmightalsousesomeinternalhelpermethodstodosuchthingsascomputetheslope
oftheregressionline.
- Implementa cardclassthatrepresentsa playingcard.Useyourclasstowritea programthat“deals”
a randomhandofcardsanddisplaysthemina graphicswindow. Youshouldbeabletofinda freely
availablesetofcardimagestodisplayyourcardsbysearchingontheInternet.