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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 00:20, kathlynskare06
Ihave been given the number of guns per 100, and the total firearm-related deaths per 100,000. i have to find the actual number of guns per country and actual number of gun-related deaths. if somebody could show me how to do 1 question, i can finish the rest, i am just confused. tia
Answers: 3
image
Computers and Technology, 23.06.2019 14:30, qveenvslayin
The basic work area of the computer is it screen that you when you first fire up your computer
Answers: 1
image
Computers and Technology, 24.06.2019 15:00, marelinatalia2000
When a presentation is being planned, it is important to ensure that it covers all available information. appeals to the audience. uses multimedia tools. entertains the audience.
Answers: 1
image
Computers and Technology, 24.06.2019 22:30, rayniqueamee2002
When can you access the bios setup utility?
Answers: 1
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 in other subjects:

Konu
Mathematics, 29.11.2020 14:00
Konu
Biology, 29.11.2020 14:00