Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project Requirements 1. You will create a Java Class called Sphere. The class should have the following: Constructor: New() Zero parameter. Creates a Sphere with

Project Requirements

1. You will create a Java Class called Sphere. The class should have the following:

Constructor: New() Zero parameter. Creates a Sphere with a radius of zero

Constructor: New(double) Creates a Sphere with the initial radius specified. If the radius specified is less than zero, the Sphere should be constructed with a radius of Zero

Methods:

double volume() Should return the volume of the Sphere

double surfaceArea() Should return the surface area of the Sphere

setRadius( double NewRadius) Should set the radius of the Sphere to the NewRadius provided NewRadius >= 0. If NewRadius <0, no change to the Sphere.

double getRadius( ) Should return the radius of the Sphere

String toString() should return the String representation of the Sphere

Sphere needs to implement the Comparable interface. The comparison should be based upon the size of the Radius.

You must include a main method with appropriate test(s). Remember what an appropriate level of testing includes.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions