• 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

One word scrabble.

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


/*You must enter a four letter word followed by the direction
and the spot you want to start on. Put spaces in between word direction and space.
EXAMPLE: JAVA
H 2
This will insert JAVA going horizontally right from spot 2.
This will return 17



Please enter your word.
AAAA

Please enter direction (H or V).
H

Please enter spot (1 through 36).
1

OUTPUT: 0000*/






Why do i get 0000. I can't find a problem with the math. hopefully you can.
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good grief! What a long main method. What non‑object‑oriented code. Wot no Square class? Wot no Word class? as Mr Chad would have said.
 
Rancher
Posts: 3742
16
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem is on line 255.
Put a print statement before that line that prints out the value of all six variables involved in the calculation and the problem should be obvious.
If it isn't, explain to us what you think that line is doing.
 
machines help you to do more, but experience less. Experience 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