Overview · Learning Goals · Files Provided · How to Test · Specifications · Constraints · Checklist · Submission · Grading

Overview

In this lab you will implement two small Java classes that model objects and their relationship: Point and Circle. This lab focuses on class structure and core object-oriented programming fundamentals.

Specification-driven lab. Follow the requirements exactly. Formatting and constructor behavior matter.

Learning Goals

Files Provided

Download all four files and place them in the same directory.

Download Point.java Download Circle.java Download PointTester.java Download CircleTester.java

Classes to Implement

These files contain Javadoc and TODO: comments. Complete the TODOs while keeping the required method signatures intact.

Basic Lab Testers (Self-Check)

The testers check several specific parts of your implementation and can help you identify common problems while you work.

These testers perform only basic checks. Passing all of these tests does not guarantee that your lab is completely correct.
Do not modify or submit PointTester.java or CircleTester.java. They are provided for development and self-checking.

How to Test

Compile your classes and the provided testers from the same directory. Run each tester as you work to check specific parts of your implementation.

Compile

javac Point.java Circle.java PointTester.java CircleTester.java

Run the Basic Testers

java PointTester
java CircleTester

Run the testers as you work. Any FAIL messages can help you identify problems in your implementation.

Exact output matters. Some tests depend on matching the required toString() formats exactly.
The written specification is authoritative. The testers check observable behavior, but they cannot verify every implementation requirement. Requirements such as private instance variables, constructor chaining with this(...), the required private validation helper, and required delegation must still be satisfied even when all basic tests pass.

Specifications

Class: Point

A Point represents a location in 2D space.

Use PointTester.java to test constructors, getters, setters, and toString().

Class: Circle

A Circle is defined by a center point and a radius.

Important toString rule: Circle.toString() must obtain the center text by calling Point.toString(). Do not manually rebuild (x, y).

Use CircleTester.java to check constructors, radius validation, setters, and required observable output.

Implementation Constraints

Testing Checklist

Submission

Before leaving lab: It is your responsibility to make sure that your lab files have been uploaded to your personal Google Drive folder by the end of the lab period.

Navigate to your personal Google Drive folder for CS231 and open the Projects folder.

  1. Create a new folder whose name matches the current project name.
  2. Place your completed lab files for this week's work in that folder.
  3. Before leaving lab, verify that the files are present in Google Drive.

For this lab, upload:

Remember: Uploading your lab files is part of completing the lab checkpoint. Do not leave the lab without confirming that your files are in your Google Drive folder.

Grading (High-Level)

Remember: The provided testers perform only basic checks. Passing all of their tests does not guarantee full credit on the lab.