How to calculate area of a circle and volume in netbeans usingjava?
construct a program using NetBeans that asks a user for acircleA????1s radius. After calculating the area of the circle, yourprogram is to compute the area of the smallest square in which thecircle can be drawn. Your program is to output the areas and thedifferences in the areas of the circle and that of the square to 2decimal places.
a. Use Math.PI for the value of ? in your program.
b. Use the printf method to output double values to 2 decimalplaces.
Sample input and output for the AreaCalculator:
This program will compute the areas of a circle and a square andtheir differences.
Input the radius of the circle in feet: 2.55
The area of the circle is: 20.43 square feet.
The area of the square is: 26.01 square feet.
The difference in areas between a square with side length 5.10feet
and a circle with radius 2.55 feet is: 5.58 square feet.
For this part of the lab you are to write a program that asksthe user for the radius of a sphere. You are to calculate thesphereA????1s volume. Your program will then compute the volume of thesmallest cube in which the sphere will fit.
Make a COPY of the project that you created as your AreaCalculator. Refactor the Project and Class name appropriately. Testto make certain that the project still works after you haverefactored it. Ask your TA for help if you have any problems withthis.
Modify your Area Calculator to the requirements of the VolumeCalculator. This program is very similar to the previous program.After completing and getting feedback the previous portion of thelab, you will most likely require little or no additional help fromthe TA. If you feel that you require significant help from the TAon this portion of the assignment please stop by and see yourcourse instructor as soon as possible so that we can you started ongood footing with these basics before moving forward.
Sample input and output for the VolumeCalculator:
This program will compute the volume of a sphere and a cube aswell as the difference of their volumes.
Input the radius of the sphere in feet: 2.55
The volume of the sphere is: 69.46 cubic feet.
The volume of the cube is: 132.65 cubic feet.
The difference in volumes between a cube with side length 5.10feet
and a sphere with radius 2.55 feet is: 63.20 cubic feet