public class Circle {
private double radius;
public Circle(double r)
{
radius = r;
}
public double getArea()
{
return Math.PI * radius * radius;
}
public double getRadius()
{
return radius;
}
public String toString()
{
String str;
str = "Radius: " + radius +
"Area: " + getArea();
return str;
}
public boolean equals(Circle c)
{
boolean status;
if(c.getRadius() == radius)
status = true;
else
status = false;
return status;
}
public boolean greaterThan(Circle c)
{
boolean status;
if(c.getArea() > getArea())
status = true;
else
status = false;
return status;
}
}
Explanation:
There is nothing with the logic of your code it work fine the problem is with the structure of your code you added an extra curly brace before declaring (r)
Am talking about this section
public class Circle {
{
private double radius;
It should be
public class Circle {
private double radius;
public class Circle {
private double radius;
public Circle(double r)
{
radius = r;
}
public double getArea()
{
return Math.PI * radius * radius;
}
public double getRadius()
{
return radius;
}
public String toString()
{
String str;
str = "Radius: " + radius +
"Area: " + getArea();
return str;
}
public boolean equals(Circle c)
{
boolean status;
if(c.getRadius() == radius)
status = true;
else
status = false;
return status;
}
public boolean greaterThan(Circle c)
{
boolean status;
if(c.getArea() > getArea())
status = true;
else
status = false;
return status;
}
}
Explanation:
There is nothing with the logic of your code it work fine the problem is with the structure of your code you added an extra curly brace before declaring (r)
Am talking about this section
public class Circle {
{
private double radius;
It should be
public class Circle {
private double radius;
#include<iostream>
using namespace std;
int main(){
float radius;
cout<<"Enter the radius of the sphere: ";
cin>>radius;
float diameter = 2*radius;
float circumference = diameter * 3.14;
float surface_area = 4*3.14*radius*radius;
float volume = (4/3)*3.14*radius*radius*radius;
cout<<"The diameter is: "<<diameter<<endl;
cout<<"The circumference is: "<<circumference<<endl;
cout<<"The surface area is: "<<surface_area<<endl;
cout<<"The volume is: "<<volume<<endl;
}
Explanation:
First include the library iostream for input/output in c++ programming.
then, create the main function and declare the variable radius as floating type.
Use cout to print the message on the screen.
Use cin to store the value in the variable.
After that, write the formula to calculate the values and store the results in the variables.
and finally print the result with message.
#include<iostream>
using namespace std;
int main(){
float radius;
cout<<"Enter the radius of the sphere: ";
cin>>radius;
float diameter = 2*radius;
float circumference = diameter * 3.14;
float surface_area = 4*3.14*radius*radius;
float volume = (4/3)*3.14*radius*radius*radius;
cout<<"The diameter is: "<<diameter<<endl;
cout<<"The circumference is: "<<circumference<<endl;
cout<<"The surface area is: "<<surface_area<<endl;
cout<<"The volume is: "<<volume<<endl;
}
Explanation:
First include the library iostream for input/output in c++ programming.
then, create the main function and declare the variable radius as floating type.
Use cout to print the message on the screen.
Use cin to store the value in the variable.
After that, write the formula to calculate the values and store the results in the variables.
and finally print the result with message.
See Explaination
Explanation:
Function drawCircle
-Expect Turtle object, coordinates of the circle's center point and
circle's radius as arguments
-Function draws circle
-Draw circle's circumference by turning 3 degrees and moving a given
distance, 120 times.
-Calculate the distance moved with formula 2.0 * 3.14 * radius /120
"""
def drawCircle (turtle, centerpoint, radius):
circumference = 2 * 3.14 * (radius/120)
print "The circumference moved is", circumference
turtle.up()
(x,y) = centerpoint[-1]
turtle.turn(3)
turtle.move(120)
turtle.down()
from turtlegraphics import Turtle
turtle=Turtle()
drawCircle(turtle, [(20,20)], 20)
1. 12cm.
2. 10cm.
3. 18cm.
4. 16cm.
5. 3cm. (or -3 if your question was negative.)
6. 36cm.
7. 8cm.
Explanation:
To find the radius of a circle, simply divide the diameter by 2.
With this being said we can just add on top of the given radius.
Example:
The given radius is 5cm. What is 5cm + 5cm? 10cm.
Thus, getting our answer.
1. 12cm.
2. 10cm.
3. 18cm.
4. 16cm.
5. 3cm. (or -3 if your question was negative.)
6. 36cm.
7. 8cm.
Explanation:
To find the radius of a circle, simply divide the diameter by 2.
With this being said we can just add on top of the given radius.
Example:
The given radius is 5cm. What is 5cm + 5cm? 10cm.
Thus, getting our answer.
See Explaination
Explanation:
Function drawCircle
-Expect Turtle object, coordinates of the circle's center point and
circle's radius as arguments
-Function draws circle
-Draw circle's circumference by turning 3 degrees and moving a given
distance, 120 times.
-Calculate the distance moved with formula 2.0 * 3.14 * radius /120
"""
def drawCircle (turtle, centerpoint, radius):
circumference = 2 * 3.14 * (radius/120)
print "The circumference moved is", circumference
turtle.up()
(x,y) = centerpoint[-1]
turtle.turn(3)
turtle.move(120)
turtle.down()
from turtlegraphics import Turtle
turtle=Turtle()
drawCircle(turtle, [(20,20)], 20)
1590.4 square feet
Step-by-step explanation:
Given: The radius of the circular area = 30 feet
Now, 25% of the radius = feet
If the we reduce the radius by 25%, then the radius of the circular area =
Now, the circular area of the spray is given by :-
Therefore, the maximum area of lawn that can be watered by the sprinkler if the radius-reduction is used at full capacity = 1590.4 square feet.
1590.4 square feet
Step-by-step explanation:
Given: The radius of the circular area = 30 feet
Now, 25% of the radius = feet
If the we reduce the radius by 25%, then the radius of the circular area =
Now, the circular area of the spray is given by :-
Therefore, the maximum area of lawn that can be watered by the sprinkler if the radius-reduction is used at full capacity = 1590.4 square feet.
It will provide an instant answer!