Write a JavaScript function named testGrade() that is able to do the following tasks: • First, pop up a prompt dialog box to ask the user to enter a test mark. Use a while-loop to verify the user input. If the input value is less than 0 or more than 100, a prompt dialog box will pop up to ask user re-enters the test mark. This prompt dialog will keep popping until the user enters a valid test mark. If the mark entered by the user is more than 70, an alert dialog box will be prompted with the message “Pass!”, otherwise an alert dialog box will be prompted with the message “Fail!”.

Question

Write a JavaScript function named testGrade() that is able to do the following tasks: • First, pop up a prompt dialog box to ask the user to enter a test mark. 

  • Use a while-loop to verify the user input. If the input value is less than 0 or more than  100, a prompt dialog box will pop up to ask user re-enters the test mark. This prompt  dialog will keep popping until the user enters a valid test mark. 
  • If the mark entered by the user is more than 70, an alert dialog box will be prompted with the message “Pass!”, otherwise an alert dialog box will be prompted with the  message “Fail!”.

    Write a JavaScript function named testGrade() that is able to do the following tasks: • First, pop up a prompt dialog box to ask the user to enter a test mark. 

    • Use a while-loop to verify the user input. If the input value is less than 0 or more than  100, a prompt dialog box will pop up to ask user re-enters the test mark. This prompt  dialog will keep popping until the user enters a valid test mark. 
    • If the mark entered by the user is more than 70, an alert dialog box will be prompted with the message “Pass!”, otherwise an alert dialog box will be prompted with the  message “Fail!”. 

Expert Answer

1 Rating

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.
Tagged in
Engineering
Computer Science

Programing Language

Other

Related Computer Science Q&A

Find answers to questions asked by students like you.

Q: Summarise how the convergence between computing, telecommunications and media led to the emergence a...

A: Disruptive technology is one that displaces an established technology and shakes up the industry or ...

Q: While troubleshooting an E-mail client issue on a user’s system, you that the incoming mail server s...

A: CORRECT OPTIONS: While troubleshooting an E-mail client issue on a user’s system, you that the incom...

Q: Write a do-while loop that continues to prompt a user to enter a number less than 100, until the ent...

A: Objective: This program includes a do-while loop to ask the user for reading an input number that mu...

Q: critically discuss how a Next‐generation Internet architecture addresses the shortcomings in the Int...

A: Internet architecture:  The Internet's architecture is described in its name, a short from of the c...

Q: 10. DATA FLOW DIAGRAM- PAYROLL Prepare a data flow diagram that reflects the activi- ties presented ...

A: Transaction Processing System (TPS) helps a business to process all the transactions as the required...

Q: Can you write a search algorith to find a c-string name inside a list of array? In C++

A: Algorithm: Declare the required variables. Use for-loop to take input from the user for names. Take...

Q: Consider two approaches to setup authentication with the wireless LAN: simple and centralised.   (e)...

A: WPA 2 is short for Wi-Fi Protected Access. It is also known as WPA2 personal as it is used in mobile...

Q: use python

A: def main() count = 0 sum =0.0 number =1 while number != 0 : data= input("Enter number:") data =input...

Q: Please use Java as the language

A: class Demo{  public static void main(String args[]){   System.out.println("Please enter any three nu...

Q: a.  What decimal number is represented by the following single precisionfloat?1 0111 1100 0110 0000 ...

A: Formula to solve this problem is:

Q: What is an example of a proper use of one of these utilities: awk, sed, tr, grep? Show syntax and ou...

A: grep: - grep stands for global regular expression point. It searches the input file for a search st...

Q: write a program to implement transformation of intersecting lines using c graphics?

A: // C program to demonstrate scaling of abjects #include<stdio.h> #include<graphics.h>  /...

Q: In java how do you: Delete the lowest/smallest item from the Circular Linked List (provided the lis...

A: Objective: This program removes the lowest element from a Circular Linked List that is already sorte...

Q: (Apartment problem) A real estate office handles, say, 50 apartment units. When the rent is, say, $6...

A: Program Approach: Include necessary header files define main method .In the main method declare and...

Q: swap: pushl %ebp movl %esp,%ebp pushl %ebx movl 12(%ebp),%ecx movl 8(%ebp),%edx movl (%ecx),%eax mov...

A:  

Q: I need to explain in details: - watermarking and fingerprints in digital fromat ( like doc or txt fi...

A: The Internet and other computerized media have revolutionized the manner in which we impart, present...

Q: Consider there are 4 stations in the token ring. There is only one packet in the ring. Suppose if th...

A: Explanation: The given case is of delayed token transmission, where the transmitter or sender is se...

Q: Please put that language as Java

A: 1)Program:-   import java.util.*;public class HelloWorld{      public static void main(String []args...

Q: How to Use/Re-Use a Variable Explain how many variables to set up in order to solve a problem in the...

A: As you have not specified the lab problem or the language of programming. I will share how to re-use...

Q: We are going to move from fixed data already in the program which is printed directly to the screen ...

A: Program description: The java program is to prompt users to get the data values for the name of the ...

Q: See attached

A: Multiple questions are asked so the first question will be answered. Please upload the question agai...

Q: Write a Bash script that removes all zero length ordinary files in the directory (including those in...

A: #!/bin/bash # start ZeroSizetargetRemover () {    # scan through all files in the current directory ...

Q: Question #3: Convert the following BNF to EBNF: <program> à begin <stmt_list> end <...

A: BNF (Backus-Naur notation) is a formal mathematical way to describe the syntax of the programming la...

Q: Assess the benefits of agile development over conventional formalisedmethodologies.

A: The benefits of agile development over conventional formalized methodologies: Concentrates on Users...

Q: Java Programming Question

A: Program description: Java FibonacciSeries.java program that prompts the user to enter the number of ...

Q: how are network services and apps are hosted within cloud environments.

A: hosting network services and apps are nothing but running a program in cloud. sending an request to ...

Q: Computer Science Question

A: Note- Hello. Since your question has multiple parts, we will solve first question for you. If you w...

Q: flowchart for this code       Declarations             num mortgagePayment             num utilities...

A: Main function flow chart:

Q: If the strMsg variable contains the string "Happy New Year", what will the IndexOf method return in ...

A: IndexOf(): The method "IndexOf()"  returns the zero-based index of the specified string’s first occ...

Q: BMI.dat (C++) Trudy 43.34 156 Sandra 71.89 174 Arthur 94.9 182 Chris 82.6 178 Write a program that r...

A:   First, we take the name of a person from the user. Then, his or her height and weight. Then, we co...

Q: Please circle True or False for each of the following statements. C++ The return type void indicates...

A: A function is a block of statements that can be reusable in a program whenever we want the same oper...

Q: Packet switching relies on router before it can be transmitted. by which the entire packet must arri...

A: Option 3 is correct that is store and forward.

Q: 1.    For a sniffer attack to succeed, what must the attacker do? How can an attacker gain access to...

A: As per our policy we are allowed to answer only one question at a time. If you want answer of some o...

Q: Mad Libs are activities that have a person provide various words, which are then used to complete a ...

A: Mad Libs are activities that have a person provide various words, which are then used to complete a ...

Q: 1.    For a sniffer attack to succeed, what must the attacker do? How can an attacker gain access to...

A: SNIFFING: Sniffing is defined as the process of monitoring the network and capturing the packets of ...

Q: Write a program that reads a text and outputs the letters, together with their counts, as explainedb...

A: Program code: #include <iostream> #include <fstream> using namespace std; // Create a s...

Q: Safari File Edit View History Bookmarks Develop Window Help 31% O Mon 11:29 PM Not Secure - codechec...

A: The structure of the program is already given in the question as below :#include <iostream>#in...

Q: First you should ask for the number of tasks to perform.   Then you should create a list of tasks wi...

A: Program description: The python program is to prompt the user to enter the number of tasks to comple...

Q: If users in your organizations use laptops and mobile to access online E-mail accounts. You are usin...

A: IMAP (Internet Message Access Protocol) allows to access email accounts at the same time on mobile a...

Q: In this lab, you write a while loop that uses a sentinel value to control a loop in a C++ program th...

A: The added code in the do-while loop with sentinel value: if(numStars < 0){           break;      ...

Q: The second number is 5.0 times the value of the first number. The second number is 2.5 times the val...

A: #include<iostream> #include<iomanip> using namespace std; int main(){     int firstNum, ...

Q: use  examples  to demonstrate your understanding of the topics: in Computer Graphics Viewing in Thre...

A: NOTE: - Hi, since it is a multipart question, so only the first three parts are answered below. Pers...

Q: Q2) (B) Write C++ program to find the summation of the even values that can be divided by 13 between...

A: Program Approach: Including necessary header files and using namespace to get the standard I/O. De...

Q: In java: Write a program using a Scanner that asks the user for a number n between 1 and 9 (inclusiv...

A: Introduction of Program: In the above Java Program, the user will enter the number of rows then the ...

Q: Write pseudocode for each example (a through e) in Exercise 2, making sure your pseudocode is struct...

A: From the above flowcharts  a) consider the modified flowchart a) Pseudo code of the flowchart: perfo...

Q: I need help problem: A two dimensional random walk simulates the behavior of a particle moving in a ...

A: Since the Programming language is not mentioned in the question, we will answer this question in Jav...