Results 1 to 4 of 4

Thread: School programming help

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2006
    Posts
    50

    School programming help

    Hi
    I am in Britain doing Standard Grade Physics. I have been given a Credit assesmant but I am stuck on it.
    Here is the task and an example from the sheet



    A program is required to prompt the user to guess a randomly-chosen whole
    number between 1 and 20. The input should be validated. If the guess is incorrect, the user should be told if the target number is bigger or smaller.
    This process should continue until the target number is guessed correctly. The user should then be told how many valid guesses were made.

    An example of output is shown below. The output from your program may look different but must meet the specification.

    I am thinking of a whole number between 1 and 20.
    What Is the number? 83
    Enter a whole number between 1 and 20, please. 0
    Enter a whole number between 1 and 20, please. 4.9
    Enter a whole number between 1 and 20, please 11

    My number is smaller than your guess.

    What is the number? 3
    My number is bigger than your guess.

    What is the number? 8
    My number is smaller than your guess.

    What is the number? 5
    My number is bigger than your guess.

    is the number? 7

    Correct. I was thinking of 7.
    The number of valid guesses was 5.



    Please help as I don't have much more time to complete this. Thanks.

  2. #2
    Frenzied Member
    Join Date
    Jun 2006
    Posts
    1,098

    Re: School programming help

    Please show us what you have done so far, and let us know where you are having trouble. We will help you, but we won't do it for you.

  3. #3
    Fanatic Member bgmacaw's Avatar
    Join Date
    Mar 2007
    Location
    Atlanta, GA USA
    Posts
    524

    Re: School programming help

    Write on what you think the logical process for doing this should be either on a piece of paper or using Notepad or other text editor. Then use this as a guide to write your code. Then if you have trouble either getting started or with a particular part of the logic or presentation, you can ask a specific question about it.

  4. #4

    Thread Starter
    Member
    Join Date
    Nov 2006
    Posts
    50

    Re: School programming help

    Thanks very much. I'll do that.

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