943,802 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Marked Solved
  • Views: 3334
  • Java RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Feb 28th, 2008
1

Re: triangle, rectangle and TwoDShape

Click to Expand / Collapse  Quote originally posted by piers ...
I changed it in my rectangle class but I am still getting 0.0 when I run my driver class.

Do you ever call the calculateAre of Triangle and Rectangle? you should call calculateArea to actually calculate and assing new value to area e.g.
Java Syntax (Toggle Plain Text)
  1. class TwoDShapeDriver
  2. {
  3. public static void main (String []args)
  4. {
  5. Triangle t1 = new Triangle(44,55,"scalene");
  6. t1.calculateArea();
  7. System.out.println(t1.toString());
  8.  
  9.  
  10. Rectangle r1 = new Rectangle(22,44);
  11. r1.calculateArea();
  12. System.out.println(r1.toString());
  13. }
  14. }
Reputation Points: 7
Solved Threads: 6
Junior Poster
new_2_java is offline Offline
127 posts
since Apr 2007
Feb 28th, 2008
0

Re: triangle, rectangle and TwoDShape

thnx m8. I have solved it. Your spot on. I wasnt using my methods properly. once I have handed the homework in I will post my solution if ur interested. Until then this is a solved thread and I think if I am able 2 u can have a rep point for your help.
Reputation Points: 10
Solved Threads: 3
Junior Poster in Training
piers is offline Offline
68 posts
since Jul 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: How to get User Name using LDAP when my application URL hitted by user in intranet
Next Thread in Java Forum Timeline: exceptions





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC