im really bad at making pseudocodes for java. i have the program and the output
ID: 3636606 • Letter: I
Question
im really bad at making pseudocodes for java. i have the program and the output i just don't know how to make a pseudocode for this program. need help!!Program
public static double side, length, width, height, base1, base2, radius;
public static void main (String args[])
{
System.out.println(" Lab07MATH06 ");
enterData();
display2DPerimeters();
display2DAreas();
display3DSurfaceAreas();
display3DVolumes();
}
public static void enterData()
{
System.out.print("Enter Side ===>> ");
side = Expo.enterDouble();
System.out.print("Enter Length ===>> ");
length = Expo.enterDouble();
System.out.print("Enter Width ===>> ");
width = Expo.enterDouble();
System.out.print("Enter Height ===>> ");
height = Expo.enterDouble();
System.out.print("Enter Base1 ===>> ");
base1 = Expo.enterDouble();
System.out.print("Enter Base2 ===>> ");
base2 = Expo.enterDouble();
System.out.print("Enter Radius ===>> ");
radius = Expo.enterDouble();
}
// Remove comments from the println statements below as you complete each of the methods of the Geometry class.
// Leave comments in place for any methods that you have not finished.
public static void display2DPerimeters()
{
System.out.println(" Perimeters of 2D Shapes");
System.out.println("=====================================================");
System.out.println("Square Perimeter: " + Geometry.squarePerimeter(side));
System.out.println("Pentagon Perimeter: " + Geometry.pentagonPerimeter(side));
System.out.println("Hexagon Perimeter: " + Geometry.hexagonPerimeter(side));
System.out.println("Octagon Perimeter: " + Geometry.octagonPerimeter(side));
System.out.println("Rectangle Perimeter: " + Geometry.rectanglePerimeter(length,width));
System.out.println("Circle Perimeter (circumference): " + Geometry.circumference(radius));
System.out.println(" ");
}
public static void display2DAreas()
{
System.out.println("Areas of 2D Shapes");
System.out.println("=====================================================");
System.out.println("Square Area: " + Geometry.squareArea(side));
System.out.println("Rectangle Area: " + Geometry.rectangleArea(length,width));
System.out.println("Parallelogram Area: " + Geometry.parallelogramArea(base1,height));
System.out.println("Triangle Area: " + Geometry.triangleArea(base1,height));
System.out.println("Trapezoid Area: " + Geometry.trapezoidArea(base1,base2,height));
System.out.println("Hexagon Area: " + Geometry.hexagonArea(base1,base2,height));
System.out.println("Circle Area: " + Geometry.circleArea(radius));
System.out.println(" ");
}
public static void display3DSurfaceAreas()
{
System.out.println("Surface Areas of 3D Shapes");
System.out.println("=====================================================");
System.out.println("Cube Surface Area: " + Geometry.cubeSurfaceArea(side));
System.out.println("Square Prism Surface Area: " + Geometry.squarePrismSurfaceArea(side,height));
System.out.println("Rectangular Prism Surface Area: " + Geometry.rectangularPrismSurfaceArea(length,width,height));
System.out.println("Sphere Surface Area: " + Geometry.sphereSurfaceArea(radius));
System.out.println(" ");
}
public static void display3DVolumes()
{
System.out.println("Volumes of 3D Shapes");
System.out.println("=====================================================");
System.out.println("Cube Volume: " + Geometry.cubeVolume(side));
System.out.println("Square Prism Volume: " + Geometry.squarePrismVolume(side,height));
System.out.println("Rectangular Prism Volume: " + Geometry.rectangularPrismVolume(length,width,height));
System.out.println("Pyramid Volume: " + Geometry.pyramidVolume(side,height));
System.out.println("Cylinder Volume: " + Geometry.cylinderVolume(radius,height));
System.out.println("Cone Volume: " + Geometry.coneVolume(radius,height));
System.out.println("Sphere Volume: " + Geometry.sphereVolume(radius));
System.out.println(" ");
}
}
class Geometry
{
// 2D Perimeters
public static double squarePerimeter (double s)
{
return 4 * s;
}
public static double pentagonPerimeter (double s)
{
return 5 * s;
}
public static double hexagonPerimeter (double s)
{
return 6 * s;
}
public static double octagonPerimeter (double s)
{
return 8 * s;
}
public static double rectanglePerimeter (double l, double w)
{
return ( l + w ) * 2;
}
public static double circumference (double r)
{
return Math.PI * 2 * r;
}
// 2D Areas
public static double squareArea (double s)
{
return s * s;
}
public static double rectangleArea (double l, double w)
{
return l * w;
}
public static double parallelogramArea (double b, double h)
{
return b * h;
}
public static double triangleArea (double b, double h)
{
return b * h / 2;
}
public static double trapezoidArea (double b1, double b2, double h)
{
return (b1 + b2) / 2 * h;
}
public static double hexagonArea (double b1, double b2, double h)
{
return (b1 + b2) * h;
}
public static double circleArea (double r)
{
return Math.PI * r *r;
}
// 3D Surface Areas
public static double cubeSurfaceArea (double s)
{
return 6 * s * s;
}
public static double squarePrismSurfaceArea (double s, double h)
{
return 2 * s * s + 4 * s * h;
}
public static double rectangularPrismSurfaceArea (double l, double w, double h)
{
return 2 * l * w + 2 * l * h + 2 * w * h;
}
public static double sphereSurfaceArea (double r)
{
return 4 * Math.PI * r * r;
}
// 3D Volumes
public static double cubeVolume (double s)
{
return s * s * s;
}
public static double squarePrismVolume (double s, double h)
{
return s * s * h;
}
public static double rectangularPrismVolume (double l, double w, double h)
{
return l * w * h;
}
public static double pyramidVolume (double s, double h)
{
return s * s * h / 3;
}
public static double cylinderVolume (double r , double h)
{
return Math.PI * r * r * h;
}
public static double coneVolume (double r , double h)
{
return Math.PI * r * r * h / 3;
}
public static double sphereVolume (double r)
{
return 4 * Math.PI * r * r * r / 3;
}
}
Output
Enter Side ===>> 4
Enter Length ===>> 5
Enter Width ===>> 6
Enter Height ===>> 7
Enter Base1 ===>> 8
Enter Base2 ===>> 9
Enter Radius ===>> 10
Perimeters of 2D Shapes
=====================================================
Square Perimeter: 16.0
Pentagon Perimeter: 20.0
Hexagon Perimeter: 24.0
Octagon Perimeter: 32.0
Rectangle Perimeter: 22.0
Circle Perimeter (circumference): 62.83185307179586
Areas of 2D Shapes
=====================================================
Square Area: 16.0
Rectangle Area: 30.0
Parallelogram Area: 56.0
Triangle Area: 28.0
Trapezoid Area: 59.5
Hexagon Area: 119.0
Circle Area: 314.1592653589793
Surface Areas of 3D Shapes
=====================================================
Cube Surface Area: 96.0
Square Prism Surface Area: 144.0
Rectangular Prism Surface Area: 214.0
Sphere Surface Area: 1256.6370614359173
Volumes of 3D Shapes
=====================================================
Cube Volume: 64.0
Square Prism Volume: 112.0
Rectangular Prism Volume: 210.0
Pyramid Volume: 37.333333333333336
Cylinder Volume: 2199.1148575128555
Cone Volume: 733.0382858376184
Sphere Volume: 4188.790204786391
Explanation / Answer
/* * (C) 2004 - Geotechnical Software Services * * This code is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This code is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ package no.geosoft.cc.geometry; /** * Collection of geometry utility methods. All methods are static. * * @author GeoSoft */ public final class Geometry { /** * Return true if c is between a and b. */ private static boolean isBetween (int a, int b, int c) { return b > a ? c >= a && c = b && c a ? c >= a && c = b && cRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.