Hello, I can compile the code below, but I cannot run it. I get the following message:
Question:
Hello,
I can compile the code below, but I cannot run it. I get the following message: No main method, Java FX application, applets, or midlets found in file.
You main be able to use the "build" menu to run in a specific way.
import java.text.DecimalFormat;
/** * * * @author * @version */ public class Ellipsoid { //Fields private String label = ""; private double a = 0; private double b = 0; private double c = 0;
//constructor /** * @param labelIn establish the label * @param aIn establishes a axes. * @param bIn establishes b axes. * @param cIn establishes c axes. */ public Ellipsoid(String labelIn, double aIn, double bIn, double cIn) { setLabel(labelIn); setA(aIn); setB(bIn); setC(cIn); }
//Methods /** * @return getLabel */ public String getLabel() { return label; }
/** * * @param labelIn this retrieves a label. * @return setLabel */ public boolean setLabel(String labelIn) { if (labelIn == null) { return false; } else { label = labelIn.trim(); return true; } }
/** * * @return getA */ public double getA() { return a; }
/** * * @param aIn this returms a boolean. * @return setA */ public boolean setA(double aIn) { if (aIn > 0) { a = aIn; return true; } else { return false; } }
/** * * @return getB */ public double getB() { return b; }
/** * * @param bIn this returms a boolean. * @return setB */ public boolean setB(double bIn) { if (bIn > 0) { b = bIn; return true; } else { return false; } }
/** * * @return getC */ public double getC() { return c; }
/** * * @param cIn this returna a boolean. * @return setC */ public boolean setC(double cIn) { if (cIn > 0) { c = cIn; return true; } else { return false; } }
/** * * @return volume */ public double volume() { double volume = ((4 * Math.PI * a * b * c) / 3); return volume; }
/** * * @return surfaceArea */ public double surfaceArea() { double thePowers = (Math.pow((a * b), 1.6) + Math.pow((a * c), 1.6) + Math.pow((b * c), 1.6)) / 3; double surfaceArea = 4 * Math.PI * Math.pow(thePowers, (1.0 / 1.6)); return surfaceArea; }
/** * * @return toString */ public String toString() { DecimalFormat decimalFormat = new DecimalFormat("#,##0.0###"); return "Ellipsoid \"" + getLabel() + "\" with axes a = " + decimalFormat.format(a) + ", b = " + decimalFormat.format(b) + ", c = " + decimalFormat.format(c) + " units has: \tvolume = " + decimalFormat.format(volume()) + " cubic units" + " \tsurface area = " + decimalFormat.format(surfaceArea()) + " square units"; } }