Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization forum!
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Liutauras Vilda
• Bear Bibeault
• Tim Cooke
• Junilu Lacar
Sheriffs:
• Paul Clapham
• Devaka Cooray
• Knute Snortum
Saloon Keepers:
• Ron McLeod
• Tim Moores
• Stephan van Hulst
• Tim Holloway
• Frits Walraven
Bartenders:
• Carey Brown
• salvin francis
• Claude Moore

# Need help asap XOXO

Greenhorn
Posts: 1
Hey guys, I'm fairly new to Java and I was wondering if I can get a hand with something.
My teacher gave me this instructions and I was supposed to pass this activity it right now.
Any help will be much appreciated. Thanks guys!
Problem:

Quadrilaterals can be a Parallelogram, Square, Rectangle, Trapezoid and Rhombus. Area and perimeter can computed from all quadrilaterals.

Create and program the inheritance tree of the shapes given above. Make sure that common attributes and methods are declared in the super class.

Create a public test class that instantiates all sub classes of Quadrilateral. Demonstrate the use of each object by setting necessary attributes in order for you to compute area and perimeter. In the test class, create a method called showDetails() that accepts a Quadrilateral reference. This method should show the area and perimeter and other specific information of the instance passed thru the argument.

Special instruction:

ONLY USE ONE JAVA FILE and name it LE6_Surname.java.

Sample Output:

SQUARE
Side: 4.0
Area: 16.0
Perimeter: 16.0

RECTANGLE
Length: 4.0
Width: 2.0
Area: 8.0
Perimeter: 12.0

RHOMBUS
Side: 2.0
Diagonal 1 (p): 2.0
Diagonal 2 (q): 2.0
Area: 2.0
Perimeter: 8.0

TRAPEZOID
Side a: 6.0
Side b (base): 8.0
Side c: 2.0
Side d: 2.0
Height: 1.0
Area: 7.0
Perimeter: 18.0

PARALLELOGRAM
Side a: 5.0
Side b (base): 6.0
Height: 4.0
Area: 24.0
Perimeter: 22.0

Java Cowboy
Posts: 16084
88
Welcome to the Ranch.

Please explain us how far you've come, and what specifically you need help with.

You'll have to create a class Quadrilateral, and subclasses for the specific kinds of shapes, as the assignment says. Did you manage to do that?

Since you'll have to put everything in one source file named LE6_Watson.java, you'll have to create a public class named LE6_Watson in that file - that will be the public test class that the assignment mentions. It will have to have a public static void main(String[] args) method, and a showDetails() method as the assignment explains.

Marshal
Posts: 64109
215
Welcome agan

There are various words we never use. ASAP is one of them.

 It is sorta covered in the JavaRanch Style Guide.