Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Boolean Method

 
Roger Sanchez
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a sample exam question that I struggling with:
Write a boolean method named digit that returns true if the value of its char type parameter is a digit (one of "0", "1", ., "9") and returns false otherwise.
Thanks,
Roger
 
Joe Pluta
Ranch Hand
Posts: 1376
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, let's see what you've got so far. For example, have you figured out the method signature yet? The method signature includes the name of the method, the type of value returned (if any) and the names and types of the parameters. Have you gotten that far? If so, show us.
Next, can you think what sort of logic you might want to use to do what you need to do? Can you write out in pseudo-code (which is just English) the steps you would take to process this function?
I hope I don't sound pedantic here. What I'm trying to do is walk you through the basic steps of analysis and design, which you need to do before you ever write a line of code.
Joe
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic