Question

Write JavaScript codes that count how many As, Bs, Cs in the following scores array, and...

Write JavaScript codes that count how many As, Bs, Cs in the following scores array, and calculate the average of the scores (Note: you can’t hard code the computation) A range >=90; 90>B range >=80; 90> C range >=70

Homework Answers

Answer #1

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Click me</button>


<script>
function myFunction() {
var arr=[88,76,75,80,99,100,96,72];
var total=0,aCount=0,bCount=0,cCount=0;
for(i=0;i<arr.length;i++){
   if(arr[i]>=90)
       aCount++;
   else if(arr[i]>=80)
       bCount++;
   else if(arr[i]>=70)
       cCount++;
   total=total+arr[i];
}
alert("A's: "+aCount+"\nB's: "+bCount+"\nC's: "+cCount+"\nAverage: "+(total/arr.length));
}
</script>

</body>
</html>

Note : Please comment below if you have concerns. I am here to help you

If you like my answer please rate and help me it is very Imp for me

Know the answer?
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
Similar Questions
Write a C++ program to perform the following tasks     a) Declare an integer array of...
Write a C++ program to perform the following tasks     a) Declare an integer array of size 1000.     b) Initialize the array with random values between 1 and 9.     c) Write the code to find and print, how many 1’s occur in the array.
6.12 LAB: Grade distribution In this lab, you will write a JavaScript program that generates a...
6.12 LAB: Grade distribution In this lab, you will write a JavaScript program that generates a bar graph of letter grades from a distributions of scores. Implement the parseScores function (1 point) Implement the parseScores function to take a space-separated string of scores as an argument and return an array of score strings. Each score is a number in the range [0, 100]. Ex: "45 78 98 83 86 99 90 59" → ["45","78","98","83","86","99","59"] Hint: JavaScript's string split() function can...
PART B- Javascript Using a text editor (VS Code or Notepad) and a web browser, you...
PART B- Javascript Using a text editor (VS Code or Notepad) and a web browser, you will demonstrate how to create an HTML file, externally link a JavaScript file, and write some source code in the JavaScript file. a..Create two blank files to be an HTML file and a JavaScript file. The file names should be partA.html and partA.js. b.. Create a basic HTML webpage structure. c..Link the JavaScript file to the HTML file using the <script> tag. d.. Prompt...
Write a program in C++ that inputs an unknown number of test scores (assume that there...
Write a program in C++ that inputs an unknown number of test scores (assume that there is a maximum of 150 scores). Ask the user how many scores that they will be entering. The program should have at least 3 functions. Make sure the functions perform the following: Calculate the average score Find the highest score Find the lowest score Sort the list from highest to lowest Output the number of scores, the average, the sorted list, the highest, and...
Write the following program in MIPS: a) declare an array A of the following numbers: 3,...
Write the following program in MIPS: a) declare an array A of the following numbers: 3, 5, 8, 10, 12, 2, 76, 43, 90, 44 b) declare a variable called size which stores the number of element in array A, that is 10. c) write a subroutine to search for a number stored in an array and return true or false. In C++ the subroutine is as follows: search(array, size, number_To_Search) e.g. search(A, 10, 12) The subroutine should return 0...
You are to write a program that will process students and their grades. For each student...
You are to write a program that will process students and their grades. For each student the program will read in a student’s name. It should also read in 10 test scores for the student and calculate his or her average. You must read the scores using a loop. The program should output the student’s name, average and letter grade. The average should be displayed accurate to 1 decimal digit. Letter grades are assigned based on the scale: 90-100    A...
Create a program to calculate and print basic stats on a set of a given input...
Create a program to calculate and print basic stats on a set of a given input values representing students' scores on an quiz. 1) Ask the user for the total number of quiz scores to be input (assume a positive integer will be given). 2) Create an array to hold all the quiz scores and then get all the scores from input to put into the array. For example, if the user input 10 in step (1) then you should...
Write a function in c using #include <stdio.h> that takes a one-dimensional integer array and returns...
Write a function in c using #include <stdio.h> that takes a one-dimensional integer array and returns the index of the first occurance of the smallest value in the array. Your function must be able to process all the elements in the array. Create a function prototype and function definition (after the main function). Your main function should declare a 100 element integer array. Prompt the user for the number of integers to enter and then prompt the user for each...
ENGR Logical Circuits How many PROM AND array rows do you use to implement the following...
ENGR Logical Circuits How many PROM AND array rows do you use to implement the following function? F1(A,B,C,D,E) = A'BCDE' + AC'D'E' + BCD'E
The following data gives the scores of 13 students in a Biostatistics exam. 75 80 28...
The following data gives the scores of 13 students in a Biostatistics exam. 75 80 28 70 95 82 75 64 61 90 81 65 91 a) Find the following statistical measures 1. Mean 2. Median 3. Mode 4. Range 5. 34th percentile 6. Interquartile Range 7. Variance 8. Standard deviation 9. Coefficient of variation. b) (Without Calculations) If the instructor decide to add up 5 marks for every student, what are the values of the statistical measures mentioned in...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT