Question: Java // Note: Do not need to explicitly import classes from java.lang but wanted to make it explicit // Goal - understand using Static classes
// Note: Do not need to explicitly import classes from java.lang but wanted to make it explicit // Goal - understand using Static classes - i.e the Math class was not designed to be Instantiated (make objects) // It is a class that provides functionality and will be used to complete one of the methods import java.lang.Math; public class Lab2Exercises // computes area of a circle when given its radius public static int areaOfCircle (double radius) /ITODO // computes perimeter of a circle when given its radius public static int perimeterOfCircle (double radius) //TODO // computes volume of a sphere when given its diameter public static double volumeOfSphere (double diameter) //TODO // computes surface area of a cylinder with given radius and height. Use pow function of Math library public static double surfaceAreaCylinder (double radius, double height) //TODO // returns a String with two lines in the // On Linel: "CircleArea: ,CirclePerimeter: // the area of the circle, perimeter, and the following format: *, Radius: *" where refers to square of radius of the circle respectively Diagonal:*"where *refers to square of diagonal of the square respectively // On Line2: "SquareArea:*, Perimeter:*, // the area of the square, perimeter, and the // (use Pythagorean Theorem) // Notice: circle and square both need only one parameter for all measurements public static String squareAndCircleMeasurements (int value) { //TODO /1 Please reuse any of the functions defined above. // reads a number between 1000 and 1 Billion and prints it with commas) separating every three digits $12,317,910 number, then concatenate back together as a String // for example: 12317910 will be printed as // hint use moduus (%) to save part of the public static String addCommas (int num) //TODO (hint look at Math class Java doc API) of the angle angleInRadians) ( // given angle in radians, convert to degrees // and return a string of the Sin, Cos, Tangent public static String trigFunctions (double // test client public static void main(String args) //TODO: Modify to test all functions // Use Scanner to read inputs from user Don't use Scanner in above functions
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
