The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 407 Weeks Ago, 6 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Write an object oriented program which can calculate the area and circumference of a circle with a given radius value.
Description: Your program will have two classes.
Class 1: Circle Class
This class has a field named radius and 5 methods: (1) a constructor that accepts the radius of the circle as an argument, (2) a no-argument constructor that sets the radius field to 50.0 (as a default), (3) setRadius method that sets the value of radius, (4) area method that calculates and returns the area of the circle corresponding to the radius value, and (5) circumference method that calculates and returns the circumference of the circle.
Class 2: CircleDemo Class
This class has the main method which creates two circle objects:
Soccer Field with radius 100.
Cricket Field with radius 150.
Play Ground with default radius of a circle.
The main function prints the area and circumference of Soccer Field, Cricket Field, and Play Ground.
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll