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.

Page 1 of 2 12 LastLast
Results 1 to 25 of 44

Thread: How to create math problems by grade level. Please Help Me.

  1. #1
    Junior Member
    Join Date
    Jun 2014
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default How to create math problems by grade level. Please Help Me.

    Hi everyone I am new to computer programming, and I need help with creating a code that will create random addition or subtraction from 0-500 depending on their grade level. I know how to create a random for the math and subtraction. I just dont know how to get it to change depending on their grade level. Example I need it to ask their name, grade level, addition or subtraction then five addition or subtraction questions depending on what they chose.

    Please help me out.

    If you need more detailed information just let me know, and I can break the whole thing down and show you what I have so far.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,216
    Thanks
    52
    Thanked 2,294 Times in 2,265 Posts

    Default Re: How to create math problems by grade level. Please Help Me.

    how to get it to change depending on their grade level.
    Can you explain what that means?
    Give a couple of examples.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Jun 2014
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: How to create math problems by grade level. Please Help Me.

    Thanks for replying so quickly, What I need it to do is ask the user what grade they are in from 1-5 then ask the user if they want to do the addition or subtraction problems, so if the student says they are in the 1st grade it will generate either addition or subtraction problems from 1-100, and if in 2nd grade it will be from 1-200 and so on.

    If this is still confusing I can send you an email with an attachment as to what it should look like when it runs.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,216
    Thanks
    52
    Thanked 2,294 Times in 2,265 Posts

    Default Re: How to create math problems by grade level. Please Help Me.

    Is this it:
    For each grade (1-5) there is a different range of numbers to be used in the math problems.

    What problems are you having with that? Do you have any specific questions?
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Jun 2014
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: How to create math problems by grade level. Please Help Me.

    I think I posted the reply did you get it?

    --- Update ---

    not sure if you ever recieved my reply, but I just need help with how to write the code for the random math generator to recognize their grade level.

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,216
    Thanks
    52
    Thanked 2,294 Times in 2,265 Posts

    Default Re: How to create math problems by grade level. Please Help Me.

    I posted the reply did you get it?
    There are 5 posts before this one, which one is the "reply" you refer to?

    how to write the code for the random math generator to recognize their grade level.
    I thought the grade level was given by the user as input to the program.
    Or is the program supposed to randomly generate a grade level for the user?
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Junior Member
    Join Date
    Jun 2014
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: How to create math problems by grade level. Please Help Me.

    no I need the program to ask their grade level, but I do not know how to write a code that will create the problems based on their grade level. I think I might be confusing you. I have only been learning Java for about two weeks now. So I have no clue on how to do this.

    I can send you an attachment that shows how the program should run if youd like.
    Last edited by Mata101Alex; June 13th, 2014 at 08:49 PM.

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,216
    Thanks
    52
    Thanked 2,294 Times in 2,265 Posts

    Default Re: How to create math problems by grade level. Please Help Me.

    Ok, the program gets the grade level from the user
    Then what will it do with that information?
    Make a list of the steps the program will take here.
    Worry about how to make a java program after the steps to solve the problem have been written down.
    If you don't understand my answer, don't ignore it, ask a question.

  9. #9
    Junior Member
    Join Date
    Jun 2014
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: How to create math problems by grade level. Please Help Me.

    ok so first:
    // ask the user for their name
    // ask the user for their grade level
    // ask the user if they want to do the addition or subtraction problems
    // generate random addition or subtraction based on their reply while keeping a count on the number of correct answers
    // then give them a report of the number of correct answers and the percentage correct.
    // finally ask the user if they would like to run the program again.

  10. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,216
    Thanks
    52
    Thanked 2,294 Times in 2,265 Posts

    Default Re: How to create math problems by grade level. Please Help Me.

    Ok, some of those steps need further expansion. For example:
    generate random addition or subtraction based on their reply while keeping a count on the number of correct answers
    What are "random addition or subtraction"s? Give an example.
    Where are the "correct answers" detected? I assume a question was asked for the user to answer.
    If you don't understand my answer, don't ignore it, ask a question.

  11. #11
    Junior Member
    Join Date
    Jun 2014
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: How to create math problems by grade level. Please Help Me.

    ok so based on their grade level I need to generate 5 math problems for them to answer. so if they say they are in the third grade and they want to do the addition problems my progam should then begin and ask them a math question from 0-300 five times total. if they answer a problem correctly it will let them know that they are correct and move on to the next math problem. If incorrect it will let them now it was wrong and move on to the next problem. Once they answer all five problems it will then generate a report for them on how they did.

    --- Update ---

    ================================================== ==========
    Welcome to the Math Practice Program
    ================================================== ==========
    Enter student’s name: Ashley D
    Enter grade level between 1 and 5: 9
    We only test grades 1 - 5...Try Again!
    Enter grade level between 1 and 5: 3
    What test do you want? (1 for addition, 2 for subtraction)
    Enter now ---> 1
    ================================================== ==========
    Starting the Addition Practice Test for Grade Level 3
    ================================================== ==========
    ---------------------------
    Question 1
    ---------------------------
    102
    + 136
    ---
    Your answer ---> 238
    >>> Correct <<<
    ---------------------------
    Question 2
    ---------------------------
    264
    + 62
    ---
    Your answer ---> 326
    >>> Correct <<<
    ---------------------------
    Question 3
    ---------------------------
    4
    + 36
    ---
    Your answer ---> 40
    >>> Correct <<<
    ---------------------------
    Question 4
    ---------------------------
    102
    + 136
    ---
    Your answer ---> 389
    >>>> WRONG <<<<

    ---------------------------
    Question 5
    ---------------------------
    222
    + 270
    ---
    Your answer ---> 342
    >>>> WRONG <<<<
    ================================================== ==========
    Addition Practice Test Results
    ================================================== ==========
    Student’s Name: Ashley D
    Grade Level: 3
    Correct Answers: 3
    Wrong Answers: 2
    Percent Correct: 60%
    ================================================== ==========
    Do you want to try again? (1 for yes, 2 for no)
    Enter now ---> 1
    Enter grade level between 1 and 5: 1
    What test do you want? (1 for addition, 2 for subtraction)
    Enter now ---> 7
    You must enter a 1 or 2...Try Again!
    What test do you want? (1 for addition, 2 for subtraction)
    Enter now ---> 2

    --- Update ---

    that is what it should look like when the program runs.

  12. #12
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,216
    Thanks
    52
    Thanked 2,294 Times in 2,265 Posts

    Default Re: How to create math problems by grade level. Please Help Me.

    Can you post the steps one per numbered line instead of writing a paragraph so I can refer to them by number. That will make it a lot easier.
    What are the steps for:
    generate random addition or subtraction based on their reply while keeping a count on the number of correct answers
    If you don't understand my answer, don't ignore it, ask a question.

  13. #13
    Junior Member
    Join Date
    Jun 2014
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: How to create math problems by grade level. Please Help Me.

    the steps are
    1. ask an addition or subtraction problem
    2. if the answer is correct let them know
    3. ask them another math problem ( five times total)
    4. once they have answered all 5 problems display how many they got right and how many wrong.

  14. #14
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,216
    Thanks
    52
    Thanked 2,294 Times in 2,265 Posts

    Default Re: How to create math problems by grade level. Please Help Me.

    ask an addition or subtraction problem
    What are the steps to decide on which type of question
    and to build the question?
    If you don't understand my answer, don't ignore it, ask a question.

  15. #15
    Junior Member
    Join Date
    Jun 2014
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: How to create math problems by grade level. Please Help Me.

    1.the program will ask them if they would like to take the addition or subtraction test. // 1 for addition 2 for subtraction
    2. If they choose 1 then all five math problems will be addition.

  16. #16
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,216
    Thanks
    52
    Thanked 2,294 Times in 2,265 Posts

    Default Re: How to create math problems by grade level. Please Help Me.

    That will have to do for now. You've skipped over how a question is created.
    Which step in that list of steps for the whole program do you want to work on?
    Write code for the steps one at a time, compile the code and execute it to test that it works before moving to the next step in the list.
    If you don't understand my answer, don't ignore it, ask a question.

  17. #17
    Junior Member
    Join Date
    Jun 2014
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: How to create math problems by grade level. Please Help Me.

    I have completed these steps:
    1. ask the user for their name
    2. get their grade level

    Now I need to figure out how to compile a code for their math problems and how to add the correct and incorrect total.

  18. #18
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,216
    Thanks
    52
    Thanked 2,294 Times in 2,265 Posts

    Default Re: How to create math problems by grade level. Please Help Me.

    Ok. That should have been outlined in the steps you posted for how to solve the problem. Review those.
    Remember to do them one at a time.

    I'm done for tonight.
    If you don't understand my answer, don't ignore it, ask a question.

  19. The Following User Says Thank You to Norm For This Useful Post:

    Mata101Alex (June 13th, 2014)

  20. #19
    Member Abhilash's Avatar
    Join Date
    Jun 2014
    Location
    Kolkata, West Bengal, INDIA
    Posts
    108
    My Mood
    Busy
    Thanks
    5
    Thanked 10 Times in 10 Posts

    Lightbulb Re: How to create math problems by grade level. Please Help Me.

    For this program, you need to understand properly what it asks. First it says to take name as input, which has practically no relation with the logic. That done, take the grade as input. Remember to keep it in a do while loop and check if input is within 1 to 5. Now initialize a variable with value grade*100
    which will be used as limit to generate random integers according to grade (i.e. 100 for 1, 300 for 3, etc.). Take input of addition or subtraction and then generate 2 random integers in a for loop which runs from 1 to 5 (for 5 questions). Every time, it generates 2 random integers within the given limit and then add or subtract them. Take input of the answer and match it with the addition or subtraction result. Keep track of no. of correct answers and no. of wrong answers and after the loop, calculate the result, which you should be able to do by yourself. Keep the whole thing in a do while loop and take input if user wants to continue. if yes, whole thing runs again otherwise - Thank you.

    Overall, it is a good program. Practice more programs like these.

    Thank you.

  21. #20
    Member Ada Lovelace's Avatar
    Join Date
    May 2014
    Location
    South England UK
    Posts
    411
    My Mood
    Angelic
    Thanks
    27
    Thanked 61 Times in 55 Posts

    Default Re: How to create math problems by grade level. Please Help Me.

    Before diving head-first in - draw out the program and concepts using pseudocode.

    It is sort of half Java half not - you think out your steps and conditions in the same order you would
    if actually writing the program. When that is done - test it psychologically in your mind - i.e become the
    user of the program. When you are more or less certain part of it works, then translate that part into
    Java and see if you were correct. If not, go back to the pseudocode and try again.

    Wishes Ada xx
    If to Err is human - then programmers are most human of us all.
    "The Analytical Engine offers a new, a vast, and a powerful language . . .
    for the purposes of mankind
    ."
    Augusta Ada Byron, Lady Lovelace (1851)

  22. #21
    Junior Member
    Join Date
    Jun 2014
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: How to create math problems by grade level. Please Help Me.

    So is pseudocode going to help me figure out what to input? I know how my layout should be I just don't know what to type for this to work.

  23. #22
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,216
    Thanks
    52
    Thanked 2,294 Times in 2,265 Posts

    Default Re: How to create math problems by grade level. Please Help Me.

    what to type for this to work.
    What step are you working on? What specific problems are you having with writing the code for that step.

    pseudo code is a "language" that is closer to human speech and not a proper computer language. The steps I was trying to get you to list for the project were similar to pseudo code. Do a Google for a better explanation.
    If you don't understand my answer, don't ignore it, ask a question.

  24. #23
    Junior Member
    Join Date
    Jun 2014
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: How to create math problems by grade level. Please Help Me.

    So how would you do this in eclipse or something? I know how to write code for asking the name and grade, but I just don't know how to write a code for the random math problems etc.

  25. #24
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,216
    Thanks
    52
    Thanked 2,294 Times in 2,265 Posts

    Default Re: How to create math problems by grade level. Please Help Me.

    code for the random math problems etc.
    You listed the steps for this. If they are not complete, then go back and re-do the steps that the program must do. When you have made a list of the steps for that part of the program THEN work on writing the java code for them. You must have thought through the steps BEFORE trying to write any code.
    If you don't understand my answer, don't ignore it, ask a question.

  26. #25
    Junior Member
    Join Date
    Jun 2014
    Posts
    17
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: How to create math problems by grade level. Please Help Me.

    I have a java programming book, but it does not teach you how to write a code that can generate random math problems and keep count of correct and incorrect. I have been looking everywhere online for help, why is it so hard?

Page 1 of 2 12 LastLast

Similar Threads

  1. Question about math.pow and math.sqrt
    By ggx7 in forum Java Theory & Questions
    Replies: 7
    Last Post: March 7th, 2014, 11:51 AM
  2. How do I create a level using different colours in a picture?
    By LukeR in forum Java Theory & Questions
    Replies: 10
    Last Post: December 27th, 2013, 09:48 AM
  3. Replies: 0
    Last Post: October 14th, 2013, 08:30 PM
  4. Problems with Math.Random() in a for loop
    By csharp100 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: September 27th, 2012, 06:18 PM
  5. Finding college level problems
    By DougFane in forum The Cafe
    Replies: 1
    Last Post: February 2nd, 2012, 07:44 AM