||CS 111 - Introduction to Computer Science
Due: Friday 2/15 at the beginning of class
1. Definitions: In your own words, define the following terms:
- instance variable (a.k.a. field)
2. Date: Exercise 3.15. Submit both Date.java and
3. Circle: Create a class Circle with
Also write a test program called CircleTest.java that creates two
different Circle objects and prints out
their area and circumference. Use double values throughout.
- a constructor that takes a radius,
- getRadius and setRadius methods,
- a getArea method, and
- a getCircumference method.
- The test program should only be calling Circle methods.
It should not be performing computations.
- Since two different Circle objects should be created, you
should be using new twice in your test code.
- Area and circumference computations should take place only in the Circle
class using only the object's radius field.
4. Student: Create a class Student with
Also write a test program StudentTest.java that
- a constructor that takes a String name,
- a getName method that returns the Student name,
- an addQuiz method that allows an int quiz score to be
added to the student's quiz total,
- a getQuizTotal method that returns the total int score of all quizzes that have been added, and
- a getQuizAverage method that returns the average double quiz score so far.
Hint: You'll need to keep track of how many quizzes have been added.
- has the user input a name,
- constructs a Student object,
- has the user enter three int quiz scores, adding each separately to the Student object
using the addQuiz(int) method, and
- prints "Student <name> has a total score of <quiz total> and an average
score of <quiz average>."
- The constructor should only take name
- Quiz scores are only added to the Student object through the
- User input is only read within the StudentTest main method.
- Your Student implementation will be tested with a different
number of calls to addQuiz. You should not need to know how
many in advance if Student is implemented correctly.