Results 1 to 4 of 4
  1. #1
    RAVRAW is offline Member
    Join Date
    Sep 2014
    Posts
    2
    Rep Power
    0

    Default 2nd week of web scripting and I am stuck.

    I have to make code a prompt that For each valid user entry, compare the entry with the value in bestScore. If the user entry is greater than the value in bestScore, set the bestScore variable equal to the user entry, because it is now the best score. Then alert best score and user's score. Here is what I have so far. Thanks.


    <title>Average Test Scores</title>
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <script>
    var total = 0;
    var entryCount = 0;
    var entry;
    var bestScore = 0;

    do {
    entry = prompt("Enter test score\n" +
    "Or enter 999 to end entries", 999);
    entry = parseInt(entry);
    if (entry >= 0 && entry <= 100) {
    total = total + entry;
    entryCount++;
    }
    else if (entry != 999){
    alert("Entry must by a valid number from 0 through 100\n" +
    "Or enter 999 to end entries");
    }
    }

    while (entry != 999);

    var average = total/entryCount;
    average = parseInt(average);
    alert("Average score is " + average/n"Best Score = " + bestScore);
    </script>
    </head>
    <body>
    <section>
    <h1>This page is displayed after the JavaScript is executed</h1>
    </section>
    </body>
    </html>

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,422
    Blog Entries
    7
    Rep Power
    28

    Default Re: 2nd week of web scripting and I am stuck.

    Do you realize that this is a Java forum and that code is JavaScript code?

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

  3. #3
    RAVRAW is offline Member
    Join Date
    Sep 2014
    Posts
    2
    Rep Power
    0

    Default Re: 2nd week of web scripting and I am stuck.

    I do now, would you recommend a good JavaScript forum?

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,422
    Blog Entries
    7
    Rep Power
    28

    Default Re: 2nd week of web scripting and I am stuck.

    Quote Originally Posted by RAVRAW View Post
    I do now, would you recommend a good JavaScript forum?
    I can't recommed any (because I don't know any); maybe Google can be of help.

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

Similar Threads

  1. JAVA scripting
    By conker5295 in forum New To Java
    Replies: 9
    Last Post: 02-22-2012, 08:49 AM
  2. Implementing Scripting
    By Yevano in forum Advanced Java
    Replies: 3
    Last Post: 01-23-2012, 12:43 AM
  3. Ant Scripting Issue
    By ant_qa in forum XML
    Replies: 0
    Last Post: 09-30-2010, 02:42 AM

Posting Permissions

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