Question

In: Computer Science

Need to HAVE a web page that uses a loop to allow a teacher to enter...

Need to HAVE a web page that uses a loop to allow a teacher to enter the following information for all students in a class: student's name, mt  grade, f  grade, hW grade, attendance grade.

program should calculate each student's numeric total grade based on the following formula:course grade = (mT*0.3)+(f*0.4)+(homework*0.2)+(attendance*0.1)File Table.html looks like this:When the button is clicked, you need to prompt the user the following information:-number of students (which will determine the number of rows in your table)-student's name-mT grade-f grade-homework grade-attendance gradeOnce all the information above is provided, a JavaScript-generated table must be created.

DEFAULT CODE

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>

<head>

<title>Student's Information</title>

</head>

<body>

  <table align ="center" width ="70%">

     <tr>

        <td colspan ="2">

           <h1>&nbsp;</h2>

           <h1>Student's Information</h1>

           <p><input type="button" id="students" value="Enter Data" /></p>

        </td>

     </tr>

  </table>

</body>

</html>

Solutions

Expert Solution

HTML file :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>

<head>

    <!-- title for web page -->

    <title>Student's Information</title>

</head>

<body>

    <table align="center" width="70%">

        <tr>

            <td colspan="2">

                <h1>&nbsp;</h2>

                    <h1>Student's Information</h1>

                    <p><input type="button" id="students" value="Enter Data" onclick="getData()" /></p>

            </td>

            

        </tr>

        <tr>

           <td>

                <!-- div to display table -->

            <div id="studentsData"></div>

           </td>

        </tr>

    </table>

    <!-- <script> is used for javascript -->

    <script>

      //function to getData

        function getData()

        {

              //declaring variable to create html table

        var table = "<table border=1><tr><th>Student's name</th><th>mT grade</th><th>f grade</th><th>homework grade</th><th>attendance grade</th><th>course grade</th></tr>";

        //asking user number of students

        var numberOfStudents = parseInt(prompt("Enter number of Students : "));

        //using for loop

        for (var i = 0; i < numberOfStudents; i++) {

            //asking user name

            var name = prompt("Enter student name :", "Name");

            //asking user mT grade

            mT = parseFloat(prompt("Enter mT grade:"));

            //asking user f grade

            f = parseFloat(prompt("Enter f grade:"));

            //asking user homework  grade

            homework = parseFloat(prompt("Enter homework grade:"));

            //asking user attendance   grade

            attendance = parseFloat(prompt("Enter attendance grade:"));

            //calculate course grade

            var courseGrade = (mT * 0.3) + (f * 0.4) + (homework * 0.2) + (attendance * 0.1)

            //create a new row in the table

            table+="<tr><td>"+name+"</td><td>"+mT+"</td><td>"+f+"</td><td>"+homework+"</td><td>"+attendance+"</td><td>"+courseGrade+"</td></tr>";

        }

        //close table

        table+="</table>";

        //display table on the web page

        document.getElementById("studentsData").innerHTML=table;

        }

    </script>

</body>

</html>

=============================================

Output :

Screen showing details after entering data :


Related Solutions

n this assignment, you will need to code a Web page that will allow a user...
n this assignment, you will need to code a Web page that will allow a user to enter their first and last names and indicate how many pets they have, if any. If they have pets, the user will be able to list up to three of their names. You will code validations on some of the fields and display error messages on the page when a field does not pass the validation test. If all the data entered is...
Problem Description Write a web page that allows a person to enter address information, salutation, and...
Problem Description Write a web page that allows a person to enter address information, salutation, and a prize amount. Place a button at the bottom of the page that, which clicked, displays the contents of a letter informing them that they've won
*Create a python function that uses a while list to allow a user to enter values...
*Create a python function that uses a while list to allow a user to enter values for sales and to add each value into a list in order to track all values entered. Set the gathering of values to stop when the value of zero is entered. Then take the created list and calculate the values within the list to return the total for all the values. Next, take the previously created list and display all the values from smallest...
Create a web page that contains a simple math test. The page should have the following...
Create a web page that contains a simple math test. The page should have the following arithmetic problems. Add a button under each problem which, when clicked, will display a prompt for the user to enter the answer. Add a swcond button which, when clicked, will check to see if the user's answer is correct. The output should be either "correct" or "incorrect" displayed in an alert box. 1. 5+9= 2. 4*6= 3. 25-14= 4. 48/3= 5. 26%6=
Create a Web page about yourself containing the following: Notepad++ The page should have a light...
Create a Web page about yourself containing the following: Notepad++ The page should have a light green background and a one inch margin. The Web page should contain: At least three headings, h1 to h3. At least two paragraphs about you. A numbered list with at least three hyperlinks. The hyperlinks cannot be the ones we created in class today which were the links to Yahoo and Google. Two horizontal rules. All the h1, h2, and h3 tags should have...
A teacher has five students who have taken four tests. The teacher uses the following grading...
A teacher has five students who have taken four tests. The teacher uses the following grading scale to assign a letter grade to a student, based on the average of his or her four test scores. -------------------------------------------------------------------- Test Score Letter Grade -------------------------------------------------------------------- 90 – 100 A >= 80 < 90 B >= 70 < 80 C >= 60 < 70 D < 60 F ------------------------------------------------------------------- Write a program that uses Python List of strings to hold the five student names,...
Describe the process involving the transmission of a Web page from a Web server to a...
Describe the process involving the transmission of a Web page from a Web server to a user’s computer.
1. An HTML document that’s generated by a web application is a ________________________ web page. 2....
1. An HTML document that’s generated by a web application is a ________________________ web page. 2. An easy way to log the progress of an application in Chrome’s Console panel is to insert __________________ methods at critical points in the code. 3. The childNodes property of a DOM object returns a/an ______________________ of the child nodes for that object. 4. The ___________________ method of an array can be used to concatenate the elements of the array into a single string.​...
write a for loop that uses the loop control variable to take on the values 0...
write a for loop that uses the loop control variable to take on the values 0 through 10. In the body of the loop, multiply the value of the loop control variable by 2 and by 10. Execute the program by clicking the Run button at the bottom of the screen. Is the output the same?
1 -​Create the code to generate a default web page. The contents of this page should...
1 -​Create the code to generate a default web page. The contents of this page should be Your​​Name, right justified
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT