File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Help with homework please Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help with homework please" Watch "Help with homework please" New topic

Help with homework please

Mike Faulk

Joined: Oct 22, 2011
Posts: 1
Hello, I am new to this forum, and new to Java as well. I just started my second Java class and I am having some problems with this program. It's a phone number dissector. So far all that I can get to print are the full number and the country code. I don't see why the other values are not getting passed. Can someone loko at this and help me out please?

here is the required driver

I know there are many ways to do this, however the assignment requires I use indexOf and substring methods as well as parseInt. Any help would be greatly appreciated.

fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11955

The best tool you have is the "System.out.println()". When I write code, I put them all over the place:

System.out.println("Got to point A");
System.out.println("Got to point B");
System.out.println("Variable x is now " + x);

put them in the beginning and ends of methods. print out what you pass into and out of each method.

Use them to see what your code is really doing. Once you know, you can comment them out as they are no longer needed.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
I agree. Here's the link:
subject: Help with homework please
It's not a secret anymore!