top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Please help me to write java program that deal with different shapes.

–2 votes
382 views

Write java program that deal with different shapes. Shapes mean geometry shapes i.e. circle, rectangle, square, and triangle.

Circle: radius
Rectangle: height and width
Square: height
Triangle: base and height

All shapes have area but each shape has specific way for calculating the area:

Circle: ½ pie square *radius
Rectangle: height * width
Square: height * height
Triangle: ½ base *height

Finally, in the main program
1. Define all different kinds of shapes
2. Call Area method for all objects and print result .

posted Nov 29, 2013 by As M Ob

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button
Do your homework yourself, if you have any specific question then only ask.

However you can invite your friends to join QueryHome so that they help you on Homework Question.

Similar Questions
+1 vote

I wanted to avoid push if any of the files is deleted from the local git clone area. Can anyone please help me with that?

I am using Stash for repository management.

+2 votes

Object Persistence as Non-Serializable
Assume that the Java programming languae does not have the serializable feature (or you want to mimic
the serializable feature manually).
Discuss the approach where you will need to write the object's state (the values of all member feilds of an
object) to a textfile.
State all possible cases where the manual approach will have pitfalls(at some instance, the manual
approach may either potentially fail or certainly will fail).

+1 vote

Implement the following functions recursively:

1- void power(int x, int y);// this function returns xy

2- void removeAll(linkedListType& obj); // this function removes all the linked list nodes. NOTE: this function is NOT a member function of the linkedListType class.

3- int seqSearch(int key); // this is a member function of the linkedListType class. It searches for the value key in the linked list. If the key is found, then its position is returned. Otherwise, -1 is returned. NOTE: in order to implement this function, you need to implement another private member function to send it the first pointer. Here is the prototype for the private member function:

int recSeqSearch(nodeType *p, int key);

...