subject

Every cylinder has a base and height, where the base is a circle. Design the class Cylinder that can capture the properties of a cylinder and perform the usual operations on a cylinder. Derive this class from the class Circle. Please do the following: Some of the operations that can be performed on a cylinder are as follows: calculate and print the volume, calculate and print the surface area, set the height, set the radius of the base and set the center of the base.
Write a test program to test your program
class Circle extends Point{
private double radius;
Circle(double xValue, double yValue, double radius){
super(xValue, yValue);
this. radius = radius;
}
public double getRadius() {
return radius;
}
public void setRadius(double radius) {
this. radius = radius;
}
public double getArea(){
return Math. PI*radius*radius;
}
public void printArea(){
System. out. format("Area of the circle: %.2f\n",getArea());
}
public double getCircumference(){
return Math. PI*2*radius;
}
public void printCircumference(){
System. out. format("Circumference of the circle: %.2f\n",getCircumference());
}
}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:00
When you collaborate or meet with a person or group online, it is called
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. sean is a computer programmer. he has programmed an application for toddlers that plays nursery rhymes. however, a logic error has occurred in the program. which problem is a likely consequence of the error? a. the program crashes every time the user wants to play the nursery rhymes. b. the program crosses its buffer boundaries and overwrites an adjacent program. c. the program plays a different nursery rhyme than the one the user intended to play. d. the program shows different structures in its programming language code. e. the program introduces new viruses every time the user plays a nursery rhyme.
Answers: 1
question
Computers and Technology, 24.06.2019 02:30
Which option completes the explanation for conflict of interest in an organization
Answers: 1
question
Computers and Technology, 25.06.2019 05:00
Brad wants to buy flowers for his friend with 33 dollars.the daisies are 1 dollar each and the roses are 2 dollars each he buy 3 more daisies than roses how much did the roses cost
Answers: 2
You know the right answer?
Every cylinder has a base and height, where the base is a circle. Design the class Cylinder that can...
Questions
question
Mathematics, 12.07.2021 18:10
Questions on the website: 13722363