• Post Reply Bookmark Topic Watch Topic
  • New Topic

java class for internal order  RSS feed

 
warwick rose
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

i,m just learning java now i have a problem where i have to run a test order on my internalOrder class from the orderTester class and i,m not sure how to do this
i hope this make scence
this is the code i have for my order class:



this is the code for my Internal class



now my orderTest class is passed though orders class if you need that code i will put it up

Thank you for your help
Wazza
 
Campbell Ritchie
Marshal
Posts: 56533
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

By order do you mean instruction/intended purchase or do you mean smallest to largest?
Why are those methods static? Why have you not given the order class a capital letter? Remember: class names start with capital letters. Also singular: Order not Orders.
Do you have overloaded constructors? Line 6 seems to have two parameters to the constructor and line 2 has three parameters? If you don't overload the constructor or use varargs, that won't compile.
If it will compile, then you have a way to show the details of each order.
I would have created an array of Order objects, and iterated that array in the test method and printed out each of the details. Then you can get away with one method only.
Only use \n or \r if somebody says they require the LF or CR characters. Use printf instead
System.out.printf("Test No %d: %n%s%n", i + 1; orders[i]);
The + 1 bit is to change 0‑based numbers for an array to 1‑based numbers as people normally use. That also shows that you shouldn't use orders as the name of the class. That method will only work properly if you override the toString method, as is the usual practice in Java®.
 
warwick rose
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

thanks for the infomation but i'm doing an assigment and that is the way i had to name them i have worked the problem out ofter looking at it again i was not calling the InternalOrder class

thanks again
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!