Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

figuring out how I could have done my final java program.

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,  I did not do well in the final but I feel that it was too hard with the limited time. anyway, I'm here to figure out how I could have done it.



this is the code, his explanation was for example if the input was 45000 then somehow in the program it would be like 45000=20000+20000+5000 then it would find the total after taxes for each then add them together. like 20000(0)+20000(0.1)+5000(0.2)= something. so my question is how I could make the program divide the input like that. one of my theories was to put the question in to make the person input his income over and over till the total reaches the limit but that would go against his explanation.
Thank you
 
Sheriff
Posts: 15519
263
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When posting code, please UseCodeTags (←click that, it's a link to detailed instructions) to make it easier to read and reference in discussion.

The code looks like it already does that. Carefully study what the for-loop does.
 
Ranch Foreman
Posts: 95
6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As you seem new around here: When posting code the editor helps you with the CODE-button which makes reading code easier. A moderator will correct this for you.
As for your question: Your explanation is very vague. It may help if you either give us the exact question you were given or at least re-phrase yours so it's more like an actual question instead of a vague summary. Don't get me wrong, but your problem may wasn't your coding skills but maybe to understand the question correctly in the first place to figure out what you were supposed to do.
 
Sheriff
Posts: 7051
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may have gotten point off because of poor formatting.  Learn HowToFormatCode (that's a link).  Also, put a space around all operators, that is...
not ...
 
My honeysuckle is blooming this year! Now to fertilize this tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic