1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Andru [333]
3 years ago
11

Write a function ""volCylinder"" that takes twofloats""r""for the radius and ""h""for the height of the cylinder and returnsthe

volumeof the cylinder. You can check the Wikipedia page to learn about volume calculation of the cylinders:
Computers and Technology
2 answers:
shutvik [7]3 years ago
8 0

Answer:

   public static double volCylinder(double r, double h){

       double volCylinder = Math.PI*(r*r)*h;

       return volCylinder;

   }

Explanation:

Using Java programming language

The function (method) is declared to accept two double parameters for radius and height

Using the formula Vol = \pi r^{2} h The volume is calculated and returned.

See a complete java code with a main method below

<em>public class num7 {</em>

<em>    public static double volCylinder(double r, double h){</em>

<em>        double volCylinder = Math.PI*(r*r)*h;</em>

<em>        return volCylinder;</em>

<em />

<em>    }</em>

<em>    public static void main(String[] args) {</em>

<em>    double radius =5.1;</em>

<em>    double height = 7.1;</em>

<em>        System.out.println("The volume of the cylinder is: "+volCylinder(radius,height));</em>

<em>    }</em>

<em>}</em>

Mandarinka [93]3 years ago
4 0

Answer:

def volCylinder(r, h):

   return 3.14 * r * r * h;    

radius = float(input("Enter the radius: "))

height = float(input("Enter the height: "))

print("The volume of the cylinder is: "+ str(volCylinder(radius, height)))

Explanation:

- Inside the function, calculate the volume of the cylinder using the formula and return the result.

- Then, take inputs from the user for radius and height as float numbers

- Call the function and print the result

You might be interested in
How do we Rewrite the following Python code to avoid error. mark=inpt("enter your mark ")
Ksivusya [100]

Answer:

mark=input("enter your mark ")

Explanation:

the input method is used to get the input from the user.

7 0
3 years ago
12. In 2009, __________ of all pedestrian fatalities were caused by impaired drivers
makvit [3.9K]
3% of pedestrian fatalities were caused by impaired drivers  
4 0
3 years ago
Read 2 more answers
What does an arrow next to a menu item indicate?
katrin2010 [14]
Can you provide a screenshot maybe?
There are many menu items.

4 0
3 years ago
How to share excel file for multiple users office 365?.
Sholpan [36]

Answer:

You would need that person email to share it with them.

5 0
2 years ago
Read 2 more answers
Problemele 2 si 3 va rog
Monica [59]

Answer:

idek

Explanation:

5 0
3 years ago
Other questions:
  • Tanya is entering the amount of money she has earned from babysitting onto an Excel spreadsheet, but the AutoComplete feature is
    9·2 answers
  • What do developers do to support software products? explain to users which development process model was used to make the produc
    8·1 answer
  • "When using BitLocker on a laptop, the laptop should not use standby mode, rather it should use hibernate mode. This is because
    7·1 answer
  • In what order does the air flow in a canister vacuum cleaner pass through the following components?
    11·1 answer
  • What helps in determining the reliability of a person to repay debt?
    13·2 answers
  • What will you do to run a presentation from a computer on which you did not prepare the presentation, and how?
    13·1 answer
  • Can someone help my friend play over-watch she new do it. I can't help her on Friday (p.s she play on Xbox she will get it on Fr
    8·1 answer
  • Can someone answer this for me will award brainliest lol
    11·2 answers
  • In this for loop, identify the loop control variable, the initialization statement, loop condition, the update statement, and th
    7·1 answer
  • You have probably heard of wearable fitness devices, such as FitBit. What new products do you think might exist in this field in
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!