Results 1 to 6 of 6

Thread: Help with Loops

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2007
    Posts
    4

    Help with Loops

    Hi i'm new to VB.net and i'm trying to figure out a way to do this question.

    • Write a solution using Structured English and
    • Using the Structured English develop a Visual Basic.Net program to solve it.:
    • The program must include a decision statement and a loop structure;


    for the following:



    The student canteen runs a discount scheme for meals allowing a student to obtain 10 meals a week from the breakfast, lunch and teas it serves Mon – Fri. In any one day only two meals may be purchased i.e one day a student could have a breakfast and lunch but not a tea but another day they may decide to have a lunch and a tea but no breakfast. Write a program to obtain the meal plans of a student for one week. It should display error messages if the rules of the discount scheme are broken (e.g. more than 10 meals a week or more than 2 a day) but also indicates if a student is missing some meals e.g. only 9 taken in the week.

    I'm thinking that doing checkboxes and then looping them for each day? i'm not sure where to start any help please!

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Help with Loops

    Since this is homework, if you show us what you have done so far and what particular items that you're having problems with then we can try to help you to solve them, but generally we don't give you the solution as a whole because that is cheating and it's unfair to other students.

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2007
    Posts
    4

    Re: Help with Loops

    Well i just have no idea where to start really. If you could set me in the right direction as i have an idea of setting error messages. Its just im not sure on how to display this. Do i use a checked list box?

  4. #4

    Thread Starter
    New Member
    Join Date
    Oct 2007
    Posts
    4

    Re: Help with Loops

    So something like for Monday

    If chkbreakfast.checked Then
    Total +=1

    If chklunch.checked Then
    Total +=1

    Ifchktea.checked Then
    Total +=1

    and then add a loop for tuesday, wednesday etc? and error messages if more than 2 and also if they dont add up to 10 an error?

  5. #5
    Fanatic Member
    Join Date
    Aug 2006
    Location
    In my head
    Posts
    913

    Re: Help with Loops

    Nevermind, it helps if I actually read the post!! I will try to repost shortly.

    Good Luck!

    D
    Platforms of choice: Visual Studio 2005/2008 Professional : Visual Studio 2010 Enterprise : PHP - Notepad++/WAMP

    Please Rate If I helped you.
    Please remember to mark threads as closed if your issue has been resolved.

    Reserved Words in Access | Connection Strings

  6. #6
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: Help with Loops

    use my code in the other forum

Posting Permissions

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



Click Here to Expand Forum to Full Width