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
In C complete the following:
Crazy boy [7]

Answer:

#include <stdio.h>

void printValues ( unsigned char *ptr, int count) // count is no of cells

{

 for(int i=0; i<count; i++) {

   printf("%d ", ptr[i]);

 }

}

int main ( )

{

 unsigned char data[ ] = { 9, 8, 7, 5, 3, 2, 1} ;

 printValues( data, sizeof(data)/sizeof(data[0]) );

}

Explanation:

Remember that the sizeof() mechanism fails if a pointer to the data is passed to a function. That's why the count variable is needed in the first place.

3 0
3 years ago
Which heading size fits for the word headings​
hjlf
The first one h4 is yhat
3 0
3 years ago
Read 2 more answers
Write a procedural programming loop.. Your loop should start variable n with a value of 10 and count down to zero. The loop shou
anastassius [24]

Answer:

//Here is the for loop in C.

for(n=10;n>0;n--)

{

   printf("count =%d \n",n);

}

Explanation:

Since C is a procedural programming language.Here if a loop that starts with n=10; It will run till n becomes 0. When n reaches to 0 then loop terminates otherwise it  print the count of n.

// here is code in C++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{  // variables

int n;

// for loop that runs 10 times

// when n==0 then loop terminates

for(n=10;n>0;n--)

{

   cout<<"count ="<<n<<endl;

}

return 0;

}

Output:

count =10

count =9

count =8

count =7

count =6

count =5

count =4

count =3

count =2

count =1

3 0
3 years ago
Who wants to be my tutor?
anzhelika [568]

Answer:

i would but im not big brain

Explanation:

8 0
3 years ago
Read 2 more answers
One way to make a data table stand out on the screen and help bring the viewer’s attention to it is to add a shadow behind the t
olganol [36]
A user can add a shadow to a table on Power Point presentation, b<span>y choosing the Layout tab under Table Tools, clicking on Effects, and selecting Shadow. The shadow can be inner, outer or perspective. The most commonly used is outer shadow.
</span>Adding a shadow behind the table will make the <span>data table to stand out on the screen and help bring the viewer’s attention.
Shades can be added also on text, tables, pictures inserted in the presentation and other object. </span>
7 0
3 years ago
Read 2 more answers
Other questions:
  • What is the primary criticism against a national identification system based on biometric data?
    13·1 answer
  • Internet control message protocol (icmp) is a method of ip address assignment that uses an alternate, public ip address to hide
    7·1 answer
  • You can use ???? a to test tread wear on your tires
    14·2 answers
  • Which of the following is not true about designing classes? In order for class information to be printed instead of a memory add
    12·1 answer
  • what is the gpa(grade point average) you need to have or you get kicked out of robotics for middle school?
    7·2 answers
  • Write a program that sorts a vector of names alphabetically using the selection sort and then searches the vector for a specific
    7·1 answer
  • When a formula contains the address of a cell, it is called a(n) ________.
    15·1 answer
  • Please code this in c++
    10·1 answer
  • What do you do when your computer shuts down
    15·2 answers
  • Laptop computers use PCMCIA cards, another type of ________
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!