Results 1 to 8 of 8
- 08-09-2012, 08:46 AM #1
Member
- Join Date
- Aug 2012
- Posts
- 15
- Rep Power
- 0
Need an important loop for my project.
Hey,
I have a school assignment to do on eclipse over the summer months.I am trying to make a vending machine.I want a piece of coding that will loop back to the beginning if the person selects an invalid item.In other words I mean that there are 5 selections and if he presses >5 it would say "Illegal Entry" and start the program again at the welcome screen.
Help would be greatly appreciated as I didn't find anything on Google about it.
P.S I am using Eclipse Juno.
Thank you.
Last edited by Nixter1997; 08-09-2012 at 08:57 AM.
- 08-09-2012, 08:56 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,386
- Blog Entries
- 7
- Rep Power
- 17
Re: Need help with my Eclipse project.PLZ HELP!!
Basically your problem has nothing to do with Eclipse (it is innocent as always). Think of a do { ... } while loop that terminates when the number input by the user is in the wanted interval. It doesn't hurt to craft a little method for this purpose that returns the wanted number; creating separate little methods reduces the complexity of the control flow so you won't end up with wall paper of if-s and while-s and complicated spaghetti code.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 08-09-2012, 09:00 AM #3
Member
- Join Date
- Aug 2012
- Posts
- 15
- Rep Power
- 0
Re: Need help with my Eclipse project.PLZ HELP!!
Thank you for you help.
- 08-09-2012, 09:02 AM #4
Member
- Join Date
- Aug 2012
- Posts
- 15
- Rep Power
- 0
Re: Need help with my Eclipse project.PLZ HELP!!
I used to do it on pascal.But on java it's a bit tricky.
- 08-09-2012, 09:14 AM #5
Re: Need an important loop for my project.
Why do they call it rush hour when nothing moves? - Robin Williams
- 08-09-2012, 09:20 AM #6
Member
- Join Date
- Aug 2012
- Posts
- 15
- Rep Power
- 0
Re: Need an important loop for my project.
tkx a lot
- 08-09-2012, 09:53 AM #7
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
- 08-09-2012, 11:04 AM #8
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Similar Threads
-
How to save project in eclipse as zip
By stuckonjava in forum EclipseReplies: 7Last Post: 03-27-2012, 06:58 PM -
Help - how to attch/add XML to eclipse project.
By vsb in forum EclipseReplies: 3Last Post: 03-11-2012, 12:30 PM -
How erase project from Eclipse
By StateMachine in forum New To JavaReplies: 6Last Post: 01-27-2012, 01:52 AM -
Creating a project in eclipse from existing project
By Suraiya in forum New To JavaReplies: 1Last Post: 10-08-2011, 09:14 AM -
Eclipse And Project Management
By Moncleared in forum Advanced JavaReplies: 0Last Post: 02-20-2009, 04:44 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks