• Post Reply Bookmark Topic Watch Topic
  • New Topic
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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Filling Array

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to write the test code in Main and don't understand how to fill my array with the methods we are supposed to use. Thanks in advance.

 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's 465 lines of code!

Can you focus on a few lines and tell us where exactly you're having trouble?
 
Teri Fisher
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, I guess I wanted to show what I had to work with, I wanted to put in an add method but we are supposed to use what is in our outline.
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I wanted to put in an add method but we are supposed to use what is in our outline.



Basically, you are writing test code. If you modify your class with special methods just for your test code, aren't you just wasting a testing opportunity?

Your class seems to have two add methods that add individual elements -- addBefore and addAfter. Do they work correctly? Have you tested them? If you have tested them, I am assuming that you wrote a loop that load them up? And if you did, can you reuse that testing code here?

Henry
 
Teri Fisher
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess that's my problem, I was trying to use my addAfter in my test code to get started but was unsuccessful. Once I get going with my array I think I'll be fine, I think that I confuse myself with my variables and I'm stuck.
 
Teri Fisher
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am narrowing it down to my addAfter and addBefore methods now that they are fixed (I think), my question is about the outputs. I know it is still too much code but I am not understanding my output--
1)Why is the addBefore order reversed and why does the list for test 1 not display 9 from the addAfter?
2)Why are there three sets of zeros at the end of the double list?

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic