Design a class named circle with fields named radius area


Problem

Complete the following tasks:

a. Design a class named Circle with fields named radius, area, and diameter. Include a constructor that sets the radius to 1. Include get methods for each field, but include a set method only for the radius. When the radius is set, do not allow it to be zero or a negative number. When the radius is set, calculate the diameter (twice the radius) and the area (the radius squared times pi, which is approximately 3.14). Create the class diagram and write the pseudocode that defines the class.

b. Design an application that declares two Circles. Set the radius of one manually, but allow the other to use the default value supplied by the constructor. Then, display each Circle's values.

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Design a class named circle with fields named radius area
Reference No:- TGS02648729

Expected delivery within 24 Hours