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, 23.06.2019 03:30
In vista and windows 7, the appearance and personalization option allows you to change the
Answers: 1
question
Computers and Technology, 23.06.2019 07:00
To produce a starlight effect in her photograph, lina should choose the filter for her camera.
Answers: 1
question
Computers and Technology, 24.06.2019 02:20
The first time a user launches the powerpoint program, which view is shown allowing the user to access recent presentations or create new presentations based on templates?
Answers: 1
question
Computers and Technology, 24.06.2019 16:00
5.a fishing rod is formed from a composite material of 0.5 kg of glass fibers embedded in a matrix of 0.5 kg of epoxy resin. the glass fibers are assumed to be long, continuous and unidirectional. to achieve a greater stiffness it is proposed to use a different composite that is comprised of long continuous carbon fibers that will be embedded in a matrix of 0.5 kg of epoxy resin. if the modulus of elasticity of the carbon fiber composite is 10% greater than the elastic modulus of the glass fiber composite, estimate the mass of carbon fibers that will be used to make the carbon fiber composite. assume the applied tensile stress is parallel to the direction of the long axis of the fibers. the epoxy resin, glass fiber, and carbon fiber have an elastic modulus of 5, 86, and 350 gpa respectively and a density of 1100, 2500, and 1800 respectively.
Answers: 3
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
Computers and Technology, 15.06.2021 22:20
question
English, 15.06.2021 22:20
question
Mathematics, 15.06.2021 22:20
question
Mathematics, 15.06.2021 22:20
Questions on the website: 13722361