Results 1 to 10 of 10
  1. #1
    gapeach97 is offline Member
    Join Date
    Dec 2008
    Posts
    5
    Rep Power
    0

    Default while Loop (Repetition) structure.

    Hello! I have a few labs that are due by this upcoming Monday and I need ALOT of help. Can anyone start me off by helping me with while Loop structure using a class roster of 10 students? I have the file attached named student1.
    Attached Files Attached Files

  2. #2
    xcallmejudasx's Avatar
    xcallmejudasx is offline Senior Member
    Join Date
    Oct 2008
    Location
    Houston, TX & Flint, MI
    Posts
    609
    Rep Power
    6

    Default

    while(some condition){
    do some stuff
    }

    in your case something along the lines
    while(number of students not equal to 10){
    add student
    }

  3. #3
    gapeach97 is offline Member
    Join Date
    Dec 2008
    Posts
    5
    Rep Power
    0

    Default

    Can you show me with the attached file?

  4. #4
    miss.meli's Avatar
    miss.meli is offline Member
    Join Date
    Nov 2008
    Location
    Austin, TX
    Posts
    17
    Rep Power
    0

    Default

    Just to give you a basis of a while loop:

    while(this statement is true){
    do this
    }

    so what your structure would look look like in pseudo-code:

    while(there's still information to get){
    get the name and store it
    }

    So some questions you can ask yourself:
    How long do I want to keeping doing this statement?
    If the while loop statement is true, what do I want to do?

    Hope this helps start you off :)
    miss.meli (-.-)zzZZ

  5. #5
    xcallmejudasx's Avatar
    xcallmejudasx is offline Senior Member
    Join Date
    Oct 2008
    Location
    Houston, TX & Flint, MI
    Posts
    609
    Rep Power
    6

    Default

    I'm not going to write your project for you. That's as simple as your program gets. Show some effort and make your own code and if you get stuck post it here and we can look at it.

  6. #6
    miss.meli's Avatar
    miss.meli is offline Member
    Join Date
    Nov 2008
    Location
    Austin, TX
    Posts
    17
    Rep Power
    0

    Default

    Are you using a Scanner or that attached file to get the information?
    miss.meli (-.-)zzZZ

  7. #7
    gapeach97 is offline Member
    Join Date
    Dec 2008
    Posts
    5
    Rep Power
    0

    Default

    it's just the attached file with the information. I'm not asking you to write my code, just start it for me so that I can see how to do. That's all.

  8. #8
    gnarly hogie is offline Member
    Join Date
    Oct 2008
    Posts
    34
    Rep Power
    0

    Default

    Why can't you start it off?

  9. #9
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    You're going to find a lot more here willing to help you if you show your efforts first. Show us the code you've created to try to solve this problem, and post it here. Also post any error messages you get or how the code isn't working. If your reply is "I don't even know where to begin" then our reply would be to either have you go to the Sun intro to Java tutorials or perhaps better sit down with your teacher for a one-on-one tutorial session.

    Best of luck.

  10. #10
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    7

    Default here's my idea...

    • ask the number of students that are going to be entered (x)
    • create an array of x string elements (x = the number that was entered above)
    • within a for cycle:
    • ask the name of the student
    • assign the string to an array element
  11. Print the numbers and names of the students using the student array
Chris S.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
Reply With Quote Reply With Quote

Similar Threads

  1. Looking for Estandard Structure oj J2EE
    By VirtualArq in forum Advanced Java
    Replies: 0
    Last Post: 09-18-2008, 06:21 PM
  2. data structure code
    By vgvt in forum New To Java
    Replies: 1
    Last Post: 01-17-2008, 02:49 PM
  3. repetition of 'arguments'(?)
    By Igor in forum New To Java
    Replies: 3
    Last Post: 12-13-2007, 10:08 AM
  4. Use if then else structure, help
    By paul in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 05:00 AM
  5. Help with Structure
    By Albert in forum New To Java
    Replies: 1
    Last Post: 07-13-2007, 03:27 PM

Posting Permissions

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