You are viewing our Forum Archives. To view or take place in current topics click here.
Java budget program question (while/for nested loops) +rep
Posted:

Java budget program question (while/for nested loops) +repPosted:

Meowers
  • TTG Contender
Status: Offline
Joined: Oct 08, 201013Year Member
Posts: 3,310
Reputation Power: 150
Status: Offline
Joined: Oct 08, 201013Year Member
Posts: 3,310
Reputation Power: 150
So I'm currently suppose to be creating two simple text files (input/output files), printing information to the input file, and then scanning the input file to see each month (string) and if it has another integer (total budget and the other 6 categories below which are added to = total spent)), and then calculating whether I was over budget for that specific month (which will be printed to the output file). I currently was able to print out the first months data in the output file but i'm getting an InputMismatchError and i'm 99% sure my nested loops are messed up somewhere. Any help at all would be helpful, and here's what I'm working with.
[ Register or Signin to view external links. ]
#2. Posted:
Xaldin
  • 2 Million
Status: Offline
Joined: Oct 09, 201013Year Member
Posts: 2,358
Reputation Power: 106
Status: Offline
Joined: Oct 09, 201013Year Member
Posts: 2,358
Reputation Power: 106
I think your nextInt() is getting the "month" after the first time through. this would cause the error.
#3. Posted:
Kyle93
  • Retired Staff
Status: Offline
Joined: Jun 25, 201013Year Member
Posts: 4,078
Reputation Power: 2628
Motto: https://www.thetechgame.com/Forums/t=7804 333/vote-for-tune-of-the-week-friday-nigh ts-lockdown-dj-sets.html
Motto: https://www.thetechgame.com/Forums/t=7804 333/vote-for-tune-of-the-week-friday-nigh ts-lockdown-dj-sets.html
Status: Offline
Joined: Jun 25, 201013Year Member
Posts: 4,078
Reputation Power: 2628
Motto: https://www.thetechgame.com/Forums/t=7804 333/vote-for-tune-of-the-week-friday-nigh ts-lockdown-dj-sets.html
Can you actually post the code and I can take a look at it for you, easier to work with code than screenshots
#4. Posted:
CriticaI
  • Summer 2023
Status: Offline
Joined: Nov 05, 201310Year Member
Posts: 2,737
Reputation Power: 448
Status: Offline
Joined: Nov 05, 201310Year Member
Posts: 2,737
Reputation Power: 448
I don't use Java, but what are the curly braces on line 17 & 85 for?
they seem out of place.
#5. Posted:
luckylobs
  • New Member
Status: Offline
Joined: Jan 03, 20177Year Member
Posts: 8
Reputation Power: 0
Status: Offline
Joined: Jan 03, 20177Year Member
Posts: 8
Reputation Power: 0
Hmm.. I am not gonna sit here and write everything up and im not really sure on what your really wanting either, but is all that code you have necessary?
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.