Coronavirus made it tough but we keep working remotely with no delays. Get 15% OFF your First Order
Get 15% OFF your First Order

Programming

Java Lab 1

I need an explanation for this Java question to help me study.

MUST BE DONE IN INTELLIJ

CSCI-2467 Lab 1 – Calculate Volume of a Cylinder

Background

The formula for the volume of a cylinder of radius r and height h is: πr2h

Assignment

Write a Java program that asks the user for the radius and height of a cylinder. The program should then calculate and print the volume of the cylinder. Be sure to include a comment in your code with your name, date, and the purpose of the program.

Start your program as follows:

package edu.cscc;
import java.lang.Math;
import java.util.Scanner;

// TODO – add a comment with your name, date, and program purpose here
public class Main {

private static Scanner input = new Scanner(System.in);

public static void main(String[] args) {
double radius, height, volume;
// TODO – write your program here
}
}

Use the built-in Java constant Math.PI for the value of π.

Example Output

Enter the radius of the cylinder: 2

Enter the height of the cylinder: 10

The volume of the cylinder is: 125.66370614359172

Looking for this or a Similar Assignment? Click below to Place your Order

× How can I help you?