filmov
tv
Volume and area of cylinder in Java / How to Tutorial

Показать описание
The volume and area of a cylinder are calculated as:
Volume = πr2h
Area = 2πrh + 2πr2
Given the radius and height of a cylinder as floating-point (double) numbers, output the volume and area of the cylinder.
Output each floating-point value with one digit after the decimal point, which can be achieved as follows:
Ex: If the input is:
5.2 8.1
where 5.2 is the radius of the cylinder and 8.1 is the height of the cylinder, then the output is:
Volume: 688.1 cubic inches
Surface area: 434.5 square inches
Volume = πr2h
Area = 2πrh + 2πr2
Given the radius and height of a cylinder as floating-point (double) numbers, output the volume and area of the cylinder.
Output each floating-point value with one digit after the decimal point, which can be achieved as follows:
Ex: If the input is:
5.2 8.1
where 5.2 is the radius of the cylinder and 8.1 is the height of the cylinder, then the output is:
Volume: 688.1 cubic inches
Surface area: 434.5 square inches