SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 313 Weeks Ago, 6 Days Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 02 Jan 2018 My Price 10.00

Main method not found in class Polygon

When I use the command prompt to run this file it does compile, then when I try to run the program it gives me an error. Error: Main method not found in class Polygon, please define the main method as:

  public static void main(String[] args)

or a JavaFX application class must extend javafx.application.Application

 

 

How do I fix this, because when I add the main method, it will not compile.

/**
 * Polygon Class
 */
public class Polygon {

    private int numSides;
    private double sideLength;
    private double xCoord;
    private double yCoord;
    private double apothem;
    public double perimeter;

    /**
     * constructor with no argument
     */
    public Polygon() {
        numSides = 4;
        sideLength = 5.0;
        xCoord = 0.0;
        yCoord = 0.0;
        apothem = 5.0;
        perimeter = 20.0;
    }

    /**
     * constructor with parameters
     */
    public Polygon(int numSides, double sideLength, double xCoord, double yCoord, double apothem) {
        this.numSides = numSides;
        this.sideLength = sideLength;
        this.xCoord = xCoord;
        this.yCoord = yCoord;
        this.apothem = apothem;
    }

    // getters and setters

    public int getnumSides() {
        return this.numSides;
    }

    public void setnumSide(int numSides) {
        this.numSides = numSides;
    }

    public double getsideLength() {
        return this.sideLength;
    }

    public void setsideLength(double sideLength) {
        this.sideLength = sideLength;
    }

    public double getxCoord() {
        return this.xCoord;
    }

    public void setxCoord(double xCoord) {
        this.xCoord = xCoord;
    }

    public double getyCoord() {
        return this.yCoord;
    }

    public void setyCoord(double yCoord) {
        this.yCoord = yCoord;
    }

    public double getApothem() {
        return this.apothem;
    }

    public void setApothem(double apothem) {
        this.apothem = apothem;
    }

    public double getperimeter() {
        return this.numSides * this.sideLength;
    }

    public double getArea() {
        return 0.5 * apothem * getperimeter();
    }

    // returns string form of polygon
    public String toString() {
        return "(numsides=" + numSides + ", sideLength=" + sideLength + ", xcoord=" + xCoord + ", ycoord=" + yCoord
                + ", apothem=" + apothem + ")";
    }
}

Answers

(5)
Status NEW Posted 02 Jan 2018 08:01 AM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)