This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Own code:Output Confusing

 
Arjun Srivastava
Ranch Hand
Posts: 432
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Input: 3
Output :how many children do you have 51
your allowance=3900
Input: 5
Output :how many children do you have 53
your allowance=3900
Input: 100
Output :how many children do you have 49
your allowance=14400
Please explain.
Thanks
 
Stephan van Hulst
Bartender
Pie
Posts: 6082
71
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take it one step at a time.

1) Print what you want the user to input.
2) Read the user input and parse it to an int.
3) Do the math.
4) Print your output message.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic