• 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

Test class shows error

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I made an application for my class that has a functionality such of a basic calculator. It takes digits then turns then appends them to another in increasing magnitude, and once an operation is selected the digit is reset to zero so that another can be added.

Once that is done the equals method is selected and returns the answer, however I'm having a problem. I'm supposed to run it through a test, but when I use the test the only value that returns correctly is the first value, after that it just repeats the same answer over and over again.

I tried several ways to fix this, but haven't succesfully figured out what I have done wrong. If someone could take a look and just tell me if there is a way to reset it so that when runTest() in the Calculator test class performs after the first method, that it resets and repeats accordingly.

I'd really appreciate it.


 
Logan Knecht
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Disregard this as I solved it by placing an if test in the digit method checking if numTest = 4 and then setting it to zero if that was the case.

Does anyone have a better suggestion on how to do this because I know this was terribly sloppy.
 
Always! Wait. Never. Shut up. Look at this tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic