P3.8 Implement a class Student. For the purpose of this exercise, a student has a name and total quiz score. Supply an appropriate constructor and method getName(), addQuiz(int score), getTotalScore(), and getAverageScore(). To compute the lattter, you also ned to store the number of quizessthat the student took. Supply a StudentTester class that test all methods;P3.12 Implement a class Moth that models a moth flying across a straight line. The moth has a position, distance from a fixed origin. When the moth moves toward a point of light, its new position is halfway between its old posistion and the position of the light source. Supply a constructor;public Moth(double initialPosition);and methods;public void moveTolight(double lightPosition);pulbic double getPosition();Your MothTester should construct a moth, move it toward a couple of light sources, and check that the moth's position is as expected.
Paper#71462 | Written in 18-Jul-2015Price : $27