how do i solve this question?

Ads
 

how do i solve this question?

1.Define a class named Circle with the following properties:

a) An integer data field named radius with protected access modifier, and a String data field named colour with private access modifier. Both data fields specify the radius and the colour of the Circle object respectively. Set the default values of radius to 1 and the colour as ââ?¬Å?redââ?¬Â?. b) A private static constant named PI with a fixed value of 3.142 that represents the value of pi. c) A default constructor. d) A constructor that creates Circle objects with the given radius value as the argument. e) A public method to display the Circle objectââ?¬â?¢s data fields. f) A public method named changeColour(String) to change the value of the Circle objectââ?¬â?¢s colour based on the value in the method argument. g) A public method named getSurfaceArea() that calculates and returns the surface area of the Circle object. Use the constant PI value for the calculation. h) A public method named getCircumference() that calculates and returns the Circle objectââ?¬â?¢s circumference. Use the constant PI value for the calculation.

Write another class named TestCircle to test the Circle program by creating two Circle objects. The first object must be created using the default constructor, while the second object must be created with the radius value of 8. Display the properties of both objects and also their surface area and circumference.

View Answers

Ads









Related Tutorials/Questions & Answers:
how do i solve this problem?
how do i solve this question?
Advertisements
i dont no how to solve it pls
how should i can solve
How do I upgrade mysql?
How can I do it? .click();
How do I decompile Java class files?
How do I initialize a byte array in Java?
How do I compare strings in Java?
How do i do the coding for 'leaving a comment' in java
How do I compile the registration form?
How do I get started with Bootstrap
How do I get started with Bootstrap
How do I learn Spring Framework?
How do I learn Spring Framework?
How do I learn Spring Framework?
How do I learn Spring Framework?
How do I learn Spring Framework?
How do I study big data?
How do I generate random number?
how do i grab the url in php?
How do I start learning MongoDB?
How do I download urllib3 for python 2.7
how do i begin a two dimensional array?
PureStack question---i dont know how to do this
PureStack question---i dont know how to do this
How do I import a CSV file in R?
How do I learn data analysis with Python?
how do i write a java program for this??
How do I do this program? I'm new to Java programming...
How do I start learning Docker

Ads