Results 1 to 8 of 8
  1. #1
    Nixter1997 is offline Member
    Join Date
    Aug 2012
    Posts
    15
    Rep Power
    0

    Question 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.

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,344
    Blog Entries
    7
    Rep Power
    20

    Default 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,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    Nixter1997 is offline Member
    Join Date
    Aug 2012
    Posts
    15
    Rep Power
    0

    Default Re: Need help with my Eclipse project.PLZ HELP!!

    Thank you for you help.

  4. #4
    Nixter1997 is offline Member
    Join Date
    Aug 2012
    Posts
    15
    Rep Power
    0

    Default Re: Need help with my Eclipse project.PLZ HELP!!

    I used to do it on pascal.But on java it's a bit tricky.

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: Need an important loop for my project.

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  6. #6
    Nixter1997 is offline Member
    Join Date
    Aug 2012
    Posts
    15
    Rep Power
    0

    Default Re: Need an important loop for my project.

    tkx a lot

  7. #7
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,802
    Rep Power
    19

    Default Re: Need help with my Eclipse project.PLZ HELP!!

    Quote Originally Posted by Nixter1997 View Post
    I used to do it on pascal.But on java it's a bit tricky.
    OK, it may be over 25 years since I did Pascal, but the logic and flow is not significantly different.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  8. #8
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,802
    Rep Power
    19

    Default Re: Need an important loop for my project.

    Please do not PM for a solution.
    If you have something to add then it goes here in the thread.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. How to save project in eclipse as zip
    By stuckonjava in forum Eclipse
    Replies: 7
    Last Post: 03-27-2012, 06:58 PM
  2. Replies: 3
    Last Post: 03-11-2012, 12:30 PM
  3. How erase project from Eclipse
    By StateMachine in forum New To Java
    Replies: 6
    Last Post: 01-27-2012, 01:52 AM
  4. Creating a project in eclipse from existing project
    By Suraiya in forum New To Java
    Replies: 1
    Last Post: 10-08-2011, 09:14 AM
  5. Eclipse And Project Management
    By Moncleared in forum Advanced Java
    Replies: 0
    Last Post: 02-20-2009, 04:44 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •