This week's giveaway is in the Testing forum.
We're giving away four copies of TDD for a Shopping Website LiveProject and have Steven Solomon on-line!
See this thread for details.
Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

comparison

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
heres a new code: how do i fix the end to say the following:

First Person: Smith, John (31)
Second Person: Doe, Mike (35)
Doe is older than Smith

and have it where three different things can happen i.e. doe older that smith, smith older than doe, or the same age.

 
Ranch Hand
Posts: 815
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This code works perfectly, once you remove all the silly mistakes.

I feel like you can figure them out on your own. but a few hints:

if(boolean)
do stuff;

is an if statement. you have

if(boolean) =
do stuff;

that equals sign doesn't make sense

next: end every statement with a ;. you may not end a string with +.

Variable names must be unique. you can't have both a string and an int with user1age.

what is 'choice'? if I'm the computer, how do I recognize 'choice'?

final note:
put some time into debugging your code before you ask someone else to fix it.
[ September 11, 2004: Message edited by: Joseph George ]
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I like to program in tiny little baby steps. I write one line of code and then check to see if it compiles. (I use a fancy IDE that checks syntax continuously as I type.) This way, whenever I do have a compiler error, I have a pretty good idea of exactly where it is, and it's usually pretty easy to recognize the mistake quickly.

I've run into quite a few very new programmers that had the habit of writing dozens of lines of code before seeing what the compiler had to say about what things. These folks also seemed to have problems figuring out fixing the dizzying web of errors they'd often face.
[ September 11, 2004: Message edited by: Dirk Schreckmann ]
 
Nick George
Ranch Hand
Posts: 815
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
appologies for a perhaps over brusque response.
 
And then we all jump out and yell "surprise! we got you this tiny ad!"
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic