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
This project is to mimic a meeting request system by checking the requesting party’s validity, and the number of people attendin
alexgriva [62]

Answer:

See explaination for the program code

Explanation:

Meeting.java

------

import java.util.Scanner;

public class Meeting {

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

final int ROOM_CAPACITY = 100;

int numPeople, diff;

String name;

System.out.println("****** Meeting Organizer ******");

System.out.print("Enter your name: ");

name = input.nextLine();

System.out.println("Welcome " + name);

do{

System.out.print("\nHow many people would attend the meeting? (type 0 to quit): ");

numPeople = input.nextInt();

if(numPeople < 0)

System.out.println("Invalid input!");

else if(numPeople != 0)

{

if(numPeople > ROOM_CAPACITY)

{

diff = numPeople - ROOM_CAPACITY;

System.out.println("Sorry! The room can only accommodate " + ROOM_CAPACITY +" people. ");

System.out.println(diff + " people have to drop off");

}

else if(numPeople < ROOM_CAPACITY)

{

diff = ROOM_CAPACITY - numPeople;

System.out.println("The meeting can take place. You may still invite " + diff + " people");

}

else

{

System.out.println("The meeting can take place. The room is full");

}

}

}while(numPeople != 0);

System.out.println("Goodbye!"); }

}

output

---

****** Meeting Organizer ******

Enter your name: John

Welcome John

How many people would attend the meeting? (type 0 to quit): 40

The meeting can take place. You may still invite 60 people

How many people would attend the meeting? (type 0 to quit): 120

Sorry! The room can only accommodate 100 people.

20 people have to drop off

How many people would attend the meeting? (type 0 to quit): 100

The meeting can take place. The room is full

How many people would attend the meeting? (type 0 to quit): 0

Goodbye!

4 0
3 years ago
Bushman and bonacci (2004) found that prejudiced participants were ____ likely to return a lost e-mail that had been addressed t
LenaWriter [7]
Prejudiced participants were less likely to return the lost email
8 0
2 years ago
As with country citizenship, with digital citizenship comes _____.
deff fn [24]

Answer: Responsible Technology usage

Explanation: Digital citizenship refers to the responsible use of technology, and the teaching of digital citizenship is essential to help students achieve and understand digital literacy, as well as the prevention of cyber bullying, online security, digital responsibility and digital health and wellness. to ensure

6 0
3 years ago
Read 2 more answers
How can you make a search phrase more effective?
Whitepunk [10]

Let's solve this together.

To make a search term more accurate, you must keep it simple and you must be able to use more specific terms. The more specific you are with what you are asking the engine about, the more friendlier it will respond.

The answer is Option B. I hope this answer helped you!

4 0
2 years ago
Options to open,save,and print a document are found on which of the following tabs? A.File B.Home C. Design D. Layout
maria [59]

Those options are usually under the "File" tab.

3 0
3 years ago
Read 2 more answers
Other questions:
  • This type of connection uses radio waves to connect devices on a network.
    9·2 answers
  • HELP PLEASE
    7·2 answers
  • An effectively distributed resume will get an interview
    12·2 answers
  • Anderson uses his computer and internet link to chart the movement of his favorite 46 stocks. He buys and sells according to the
    15·1 answer
  • True or False?
    8·1 answer
  • Geobubble Chart (2D) displaying Robot Density Per 10,000 Employees for the specified countries;
    7·1 answer
  • A DESKTOP COMPUTER (NAMED WORKSTATION22) CAN'T CONNECT TO THE NETWORK. A NETWORK CARD WAS PURCHASED WITHOUT DOCUMENTATION OR DRI
    14·1 answer
  • Some data files should be totally hidden from view, while others should have ____ so users can view, but not change, the data.
    11·1 answer
  • A simulation system is a technology that enables you to take over a customer’s screen, mouse, or other connected device in order
    13·1 answer
  • What property must be set on a menu item to have the user activate that option by pressing Ctrl C on the keyboard
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!