• Post Reply Bookmark Topic Watch Topic
  • New Topic

Own code:Output Confusing  RSS feed

 
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
Saloon Keeper
Posts: 7722
142
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!