CSE114Assign6 S24
CSE114Assign6 S24
What to Submit
Combine all your .java files from the problems below into a single zip file named as indicated
in the Submission Instructions section at the end of this assignment. Upload this file to
Brightspace as described in that section.
Multiple submissions are allowed before the due date. Only the last submission will be
graded.
Please do not submit .class files or any that I did not ask for.
Problem 1 (5 Points)
Create a class called Circle2D. This will hold a circle with a specific center given by X and Y
coordinates and having a radius..
Part 1
Define the Circle2D class that contains:
Two fields of type double named x and y that specify the center of the circle.
A field of type double named radius
A no-arg constructor that creates a default circle with (0, 0) for (x, y) and 1.0 for radius.
A constructor that creates a circle with the specified x, y, and radius.
Getter methods for x,y, and radius
2. A method that returns the perimeter of the circle. The method header is:
3. A method that returns true if the specified point (x, y) is inside the circle (see the figure
below). The method header is:
4. A method that returns true if the specified circle is inside this circle (see the figure below).
The method header is:
5. A method that returns true if the specified circle overlaps with this circle (see the figure
below). The method header is:
Write a test program named UseCircle2D that creates a Circle2D object c1 with its x, y coordinates
of 2.0, 2.0 and the radius as 5.5.
Display the area and the perimeter of c1. Limit the printed values to 2 decimal places.
Display the result of:
c1.contains(3.0, 3.0)
I am providing an almost complete implementation of UseTeam.java and your job is to complete the
remainder of UseTeam.java and create Player.java and Team.java in such a way that
UseTeam.java will work without modifying its existing code. By that I mean that you may add more
to UseTeam.java but you are NOT allowed to modify the methods that I have already included. In
other words, you are not allowed to change the signatures of the methods called in UseTeam..
Below this PDF in the assignment, you will see two files:
• UseTeam.java: the use code of the classes that you will provide. Read my comments in
this file carefully. Additional problem requirements are specified in this file.
• output.txt: a sample output generated by running the main of UseTeam in my model
solution. Your completed program will have to generate the output that is identical to my
sample output. The batting averages should be exact or very close (within .001). If you want
to add other features in addition to my sample output, you are welcome to do so, but try to be
brief for readability.
Restrictions: Do not use public fields in the classes that you design. Use private fields and provide
getters and setters where appropriate so that accesses can be made to the fields through the getters and
setters.
Hand in your Player.java, Team.java, and UseTeam.java. If your solution uses additional
files, hand in the source files for them as well.
Submission Instructions
Please follow this procedure for submission: