Question

Write JavaScript code to allow a school teacher to enter the names of his/her students and...

Write JavaScript code to allow a school teacher to enter the names of his/her students and the final grade for each student. Use parallel arrays named student[] and grade[] and a sentinel value so that the teacher can enter as many students as desired.

var student =new Array (200);
var grade=new Array(200);

student[]= prompt( "what is your students name");
document.getElementbyId(student[])

grade[]= prompt("what is the" + student[]+ " grade");
document.getElementbyId(student[])

document.write (student[] + " "+ grade[]);

0 0
Add a comment Improve this question Transcribed image text
Answer #1
Explanation::
  • Code in JavaScript is given below
  • Sentinel value is "-1" in name
  • So when you enter -1 in name section then input taking is stopped
  • Output is given at the end

Code:

<!DOCTYPE html>

<html>

<body>

<p>Students data is as follows</p>

<b>Name Grade</b>

<script>

var student = new Array(200);

var grade = new Array(200);

var i=0;

while(i<200){

student[i]=prompt("What is your students name");

if(student[i]=="-1"){

break;

}

grade[i]=prompt("What is the "+student[i]+" grade");

document.write("<br>"+student[i]+" "+grade[i]);

i++;

}

</script>

</body>

</html>

_____________________________________________________________

OUTPUT::

Students data is as follows

Name Grade

Steve 89

Roger 90

Tom 56

Add a comment
Know the answer?
Add Answer to:
Write JavaScript code to allow a school teacher to enter the names of his/her students and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • A teacher wants to create a list of students in her class. Using the existing Student...

    A teacher wants to create a list of students in her class. Using the existing Student class in this exercise. Create a static ArrayList called classList that adds a student to the classList whenever a new Student is created. In the constructor, you will have to add that Student to the ArrayList. Coding below was given to edit and use public class ClassListTester { public static void main(String[] args) { //You don't need to change anything here, but feel free...

  • Please help me with this code for javascript. <!DOCTYPE html> <html> <head> <title>Strings and Arrays</title> <script>...

    Please help me with this code for javascript. <!DOCTYPE html> <html> <head> <title>Strings and Arrays</title> <script> function wrangleArray() { var string1 = prompt("Enter: This class is going to fast");//Must be entered by the user var string1 = "";//Is this right? I want that string to change later by a series of prompt questions document.getElementById("div1").innerHTML = "<p>" + sentence + "</p>"; var words = sentence.split(" ");//I need to convert my string to an Array is this the way to do it?...

  • Write a C++ program that asks user number of students in a class and their names....

    Write a C++ program that asks user number of students in a class and their names. Number of students are limited to 100 maximum. Then, it will ask for 3 test scores of each student. The program will calculate the average of test scores for each student and display with their names. Then, it will sort the averages in descending order and display the sorted list with students’ names and ranking. Follow the Steps Below Save the project as A4_StudentRanking_yourname....

  • Language: C++ Write a program that will allow the instructor to enter the student's names, student...

    Language: C++ Write a program that will allow the instructor to enter the student's names, student ID, and their scores on the various exams and projects. A class has a number of students during a semester. Those students take 4 quizzes, one midterm, and one final project. All quizzes weights add up to 40% of the overall grade. The midterm exam is 25% while the final project 35%. The program will issue a report. The report will show individual grades...

  • In C++, write a complete program that receives a series of student records from the keyboard...

    In C++, write a complete program that receives a series of student records from the keyboard and stores them in three parallel arrays named studentID and courseNumber and grade. All arrays are to be 100 elements. The studentID array is to be of type int and the courseNumber and grade arrays are to be of type string. The program should prompt for the number of records to be entered and then receive user input on how many records are to...

  • Your assignment is to write a grade book for a teacher. The teacher has a text file, which includ...

    Your assignment is to write a grade book for a teacher. The teacher has a text file, which includes student's names, and students test grades. There are four test scores for each student. Here is an example of such a file: Count: 5 Sally 78.0 84.0 79.0 86.0 Rachel 68.0 76.0 87.0 76.0 Melba 87.0 78.0 98.0 88.0 Grace 76.0 67.0 89.0 0.0 Lisa 68.0 76.0 65.0 87.0 The first line of the file will indicate the number of students...

  • Using arrays create a personal phone directory that contains room for first names and phone numbers...

    Using arrays create a personal phone directory that contains room for first names and phone numbers for 20 people. Using the "names.txt" retrieve the first name and phone number for each person and store in arrays (parallel). Prompt the user for a name, search for the name, and if name is found in the array, display the corresponding phone number. If the name is not found, prompt the user to enter a phone number, and add the new name and...

  • [JAVA/chapter 7] Assignment: Write a program to process scores for a set of students. Arrays and...

    [JAVA/chapter 7] Assignment: Write a program to process scores for a set of students. Arrays and methods must be used for this program. Process: •Read the number of students in a class. Make sure that the user enters 1 or more students. •Create an array with the number of students entered by the user. •Then, read the name and the test score for each student. •Calculate the best or highest score. •Then, Calculate letter grades based on the following criteria:...

  • C# Write a program that takes a list of information and grades of the students of...

    C# Write a program that takes a list of information and grades of the students of a class and perform some processing. Take the following steps to write the program. The program must give the user two options such as a menu. At the beginning of the program must ask the following from the user: Which task you want to do (choose an option between 1-2), 1- Entering new information 2- Searching a student If the user types something rather...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT