Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Help =/

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help =/

    Hello,

    I am currently working on a code for my intro to java class and i need some help. Im supposed to make a program that checks the answers to a driver's license test. we are to create two arrays, one with all of the right answers, and the other that holds the user's answers. (I am here in the code so far, everything works)

    I am to compare both arrays, and find the number of correct answers. I am also to find which are incorrect and which number it is (theres 20 questions).

    i have looked online and on youtube but i cant seem to find anything that will help me with this. My book only covers how to compare the sizes of the arrays not the elements themselves. i have no idea how to compare them, let alone finding and storing the correct ones, and the incorrect ones with its corresponding number.

    any tips or ideas that could help me out? =/

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,195
    Thanks
    49
    Thanked 2,172 Times in 2,145 Posts

    Default Re: Help =/

    Do you know how to reference an element of an array? You use a reference to an element to an array exactly the same as a variable of the same type. anArray[idx] == anInt
    Take a look at this tutorial:
    Arrays (The Java™ Tutorials > Learning the Java Language > Language Basics)
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Apr 2012
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help =/

    yeah I understand that. Would i have to compare each element in each array to each other?

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,195
    Thanks
    49
    Thanked 2,172 Times in 2,145 Posts

    Default Re: Help =/

    What are the program requirements?
    If you don't understand my answer, don't ignore it, ask a question.