Question: Hello I use netbeans to program this java project. I've got the below one. Please help me fix it and complete the requirements below. It

Hello I use netbeans to program this java project. I've got the below one. Please help me fix it and complete the requirements below. It needs separate class in different files so please bold the class names. And please show copy of some outputs. Thank you so much!!!!

Requirement:

I have design three classes Main,RegularPolygon and RegularPentagon. then need implement a class called Trigont{} and a class called Tetragon(}. The class called Trigon[} could also be called EquilateralTrianglef{}. The class called Tetragon{} could also be called Square{}.

Hello I use netbeans to program this java project. I've got the3.23below one. Please help me fix it and complete the requirements below.It needs separate class in different files so please bold the class

names. And please show copy of some outputs. Thank you so much!!!!

Main.Java

public class Main {

public static void main(String[] args) { RegularPolygon PolygonA = new RegularPolygon("polygonA", 4, 1.0); RegularPolygon PolygonB = new RegularPolygon("polygonB", 5, 1.0); RegularPentagon pentagonA = new RegularPentagon("pentagonA", 1.0); System.out.println ("ProgramAAI commencinq execution." +" "); System.out.print (polygonA); System.out.println ("Area of polygonA = " + polygonA.Area()+" square units" + " "); System.out.printIn ("Interior angles of polygonA = "+polygonA.InteriorAngle() + " degrees" + " "); System.out.println("Area of polygonB = " + polygonB.Area() +square units" + " ") ; System.out.println ("Interior angles of polygonB = "polygonB.InteriorAngle() + " degrees" +" "); System.out.print (pentagonA) ; System.out.println ("Area of pentagonA = " + pentagonA.Area() +"square units" + " "); System.out.println("ProqramAAI terminating execution." + " "); } // Method main() }// Class Main{}

RegularPolygon.Java public class RegularPolygon { private String polygonName; private int nbSides; private double sideLength; public RegularPolygon(){ polygonName = ""; nbSides = 0; sideLength = 0.0; } public RegularPolygon(String polygonName, int nbSides, double sideLength){ this.polygonName = polygonName; this.nbSides = nbSides; this.sideLength = sideLength; } public String GetPolygonName(){ return polygonName; } public int GetNbSides(){ return nbSides; }

public double GetSideLength(){ return sideLength; }

public void SetPolygonName(String polygonName){ this.polygonName =polygonName; }

public void GerNbSides(int nbSides){ this.nbSides = nbSides; }

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

public double Area(){ return (nbSide*Math.pow(sideLength,2.0))/(4.0*Math.tan(Math.PIbSides));

}

public double Perimeter(){ return(nbSides*sideLength); }

public double InteriorAngle(){ return ((nbSides-2)*(180.0))bSides; }

@Override public String toString(){ String string; string = "===============" +" " + "Super class RegularPolygon{}" +" "+ "From toString() method: execution commencing." +" "+ "Object Data ==>" + " " + "Polygon Name ==> " + polygonName + " "+ "Number of Sides ==>" + nbSides + " "+ "Length of Sides ==> " + sideLength + " units " +" " + " " + "Instance of the RegularPolygon{} class." + " " + " Excution terminating." +" "+ "================" +" " +" "; return string; } // Method toString()

} // Class RegularPolygon{}

RegularPentagon.Java public class RegularPentagon { private String pentagonName; private double sideLength; } public RegularPentagon(){ super(); pentagonName = ""; sideLength = 0.0; } public RegularPentagon(String pentagonName, double sideLength){ super(pentagonName,3,sideLength); this.pentagonName = pentagonName; this. sideLength = sideLength; }

public String GetPentagonName(){ return pentagonName; } @Override publiv double GetSideLength(){ return sideLength; }

public void SetPentagonName(String pentagonName){ this.pentagonName = pentagonName;; }

@Override public void SetSideLength(double pentagonName){ this.sideLength = sideLength; } @Override public double Area (){ double k = Math.sqrt(5*(5+2*Math.sqrt(5))); double s =sideLength; return (1.0/4.0)*Math.pow (s,2.0)*k; }

@Override public String toString(){

return " ============" + " " + " ============" + " " + " RegularPentagon object " + " " + "From toString method execution commencing" + " " + " "+ super.toString()+ "RegularPentagon objecy: " + " "+ "Regular Pentagon Name = " + pentagonName +" " + " Regular Pentagon Side Length = " + sideLength + " units " + " " + "RegularPentagon object." + " " + "Execution terminating " + " " + "============" + " " + "============" + " " + " ";

} // Method toString() // Class RegularPentagon{}

1. Input the code for the classes of ProgramAAI and execute the final program. Make sure that it produce output identical to Listing 3.23. 2. Extend ProgramAAI, and so design and implement another class called either RegularTrigon or EquilateralTriangle. An equilateral triangle is a regular trigon. Remember, that for an equilateral triangle the lengths of all three sides are equal. There should be two private instance variable: trigonName and sideLength 3. In the design of the RegularTrigon class, be sure to over-ride the toString method. Also, over-ride the Area () method in the RegularPolygon class by writing a new method Area() in your RegularTrigon class. Choose a different formula for area, a formula which could execute more rapidly, like A = (V3/4)s?, where s is the side length of a regular trigon, instead of Equation 3.26, which is used in the RegularPolygon class. 4. For the RegularTrigon{} class, over-ride the Perimerter() method in the base class RegularPolygon{}. For an equilateral triangle, the perimeter is simply P = 3 s, where s is the side length. 5. Code the no parameter and creation constructors. Also, code the accessor and mutator methods. Add code to the main() method to demonstrate that these various methods function as expected. 6. Design and implement another class called RegularTetragon, or it could also be named Square. Code for the RegularTetragon class the same functionality that was imple- mented for the RegularTrigon class. Add code to the main() method that thoroughly exercises the methods in the RegularTrigon class. A Menu class and a user loop is not necessary. The code in the main() function shall simply be an iron boot, where all feet can be forced to fit one size. ProgramAAI commencing execution. Super class RegularPolygon{ } From toString() method: execution commencing. Object Data ==> Polygon Name ==> polygonA Number of Sides ==> 4 Length of Sides ==> 1.0 units Instance of the RegularPolygon{} class. Execution terminating. 5 Area of polygonA = 1.0000000000000002 square units Interior angles of polygonA = 90.0 degrees Area of polygonB = 1.720477400588967 square units Interior angles of polygonB = 108.0 degrees RegularPentagon object From toString method: execution commencing ==> Super class RegularPolygon{ } From toString() method: execution commencing. Object Data Polygon Name ==> pentagonA Number of Sides ==> 3 Length of Sides ==> 1.0 units Instance of the RegularPolygon{ } class. Execution terminating. RegularPentagon object : Regular Pentagon Name = pentagonA Regular Pentagon Side Length = 1.0 units RegularPentagon object. Execution terminating. 44 45 46 47 49 48 Area of pentagonA = 1.720477400588967 square units 50 ProgramAAI terminating execution. Thus the above concludes my (Derkacht work on ProgramAAL for Pro If the radian measure is used for the argument of the tan(O) function, then Equation 3.26 is appro- priate. ns2 A = 4 tan(r) (3.26)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!