Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 26th, 2007, 09:42 PM
new2oop new2oop is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2007
Posts: 1 new2oop User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 49 sec
Reputation Power: 0
Lightbulb Project Help

hi there, i am totaly stuck, i didn't understand anything from the java project given blow:
Quote:
Project 3:

1. Define a GenArith interface giving the add, sub, mul, div, abs methods to be supported

for any number type which implements this interface. abs should return a positive double value

Here is a (partial) definition for the class:

public interface GenArith{

public GenArith add(GenArith input);

................................

public double abs();

................................

}

2. Define GenReal class that implements the GenArith interface.

Here is a (partial) definition for the class:

public class GenReal implements GenArith{

double value;

public GenArith add(GenArith input){

GenReal r;

if (input instanceof GenReaL){

r=(GenReal)input;

...............

}

else if (input instanceof .........)

.........

........

}

3. Define GenInteger class that implements the GenArith interface.

Here is a (partial) definition for the class:

public class GenInteger implements GenArith{

int value;

................................

}

4. Define GenRational class that implements the GenArith interface.

Here is a (partial) definition for the class:

public class GenRational implements GenArith{

int numerator, denumerator;

................................

}

5. Define GenPolynomial class which represents a polynomial in one variable over the real numbers.Just give a blank definition for the div and abs methods; and add an absPol method take abs of each coefficient in the polynomial and returns the new polynomial.

A polynomial object can be operated with any object from the other classes. So, make your design so that a polynomial object can be added, subtracted or multiplied by any object from the other classes or the GenPolynomial class and vice versa. Think the type of the resultant object you should return and the characteristics of the operation.

Here is a (partial) definition for the class:

public class GenPolynomial implements GenArith{

double [] coeffs;

public GenArith div(GenArith input){ return null;}

public double abs(){ return 0;}

public GenPolynomial absPol(){

................................

}

................................

}

The coefficients of the polynomial are stored in the array coeffs starting with the constant term.

6. Write the proper constructor for these classes.

7. Write a method for the GenPolynomial class,

GenPolynomial multiplyByX()

That produces a new Polynomial object that repesents the result of multiplying the

current polynomial by x, where the polynomial is a polynomial in x.

8. Write a method for the GenPolynomial class,

GenPolynomial multiplyByAxPlusB (double a, double b)

That produces a new Polynomial object that repesents the result of multiplying the

current polynomial by (ax +b), where the polynomial is a polynomial in x.

9. Write a method for the GenPolynomial class,

GenPolynomial differentiate()

That returns a new Polynomial object that represents the differentiated form of the polynomial.

10. Write a method for the GenPolynomial class,

GenPolynomial integrate()

That returns a new Polynomial object that represents the integrated form of the polynomial with constant term=0..

11. Your classes should obviously have suitable toString() methods


i would code but i have no idea what to code, i don't even know the purposes of the given classes, it's not fair enough.. I just need to be guided. I can code but it's impossible to code without knowing the aim of the project.. I would appreciate if anyone would share their thoughts about the project and tell me what to do! Thanks...

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > Project Help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT