Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
  • Carey Brown
  • salvin francis
  • Claude Moore

Output format off?  RSS feed

Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I'm trying to get my program to output these specifications:

Please enter first zipcode:  17551
Please enter second zipcode:  90210
MILLERSVILLE, PA 17551 is 2331.91 miles from BEVERLY HILLS, CA 90210

This is what I get:

Please enter first zipcode: 00705
Please enter second zipcode :10458

My code:

Any help would be appreciated

Posts: 5776
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On lines 112 and 113 you are printing the indexes not the contents at those indexes. On line 115 you are using printf() incorrectly. printf() takes as its first argument a format string, followed by zero or more parameters to provide the values for the specified formats. You are passing in a composite string that is already formatted and not correctly.
Police line, do not cross. Well, this tiny ad can go through:
Create Edit Print & Convert PDF Using Free API with Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!