(CO 4 and 5) Create a program that will read in a list of test scores from the user and add them to a list. Ask the user in between each score if they want to continue (y/n). Display all of the scores entered and the total score at the end. Using the code below, put the code in the proper order Sample output: Welcome to the Test Score Program Add score: 88.45 Do you want to continue

Answers

Answer 1

Answer and Explanation:

Using Javascript:

function AddScores(){

Window.alert("Welcome to the Test Score Program");

var ScoreList= new Array();

ScoreList.push(Prompt("Add Score"));

var WhatNext= Confirm("do you want to continue?");

If(WhatNext===true) {

do{

ScoreList.push(Prompt("Add Score"));

}

While(

Confirm("do you want to continue?")===true;);

}

Alert(ScoreList);

Alert(ScoreList.reduce(function(a,b){return a +b};,0);)

}

AddScores();

From the above code in javascript programming language, we have created a list ScoreList and added elements to it using push method of the array object and a do...while loop that checks the condition and then adds the user's input to the array. We then alerted the array to the screen and then summed up the array elements and also alerted to the screen.


Related Questions

what are the different steps while solving a problem using computer? explain​

Answers

Explanation:

The following six steps must be followed to solve a problem using computer.

Problem Analysis.

Program Design - Algorithm, Flowchart and Pseudocode.

Coding.

Compilation and Execution.

Debugging and Testing.

Program Documentation.

The following method is intended to return true if and only if the parameter val is a multiple of 4 but is not a multiple of 100 unless it is also a multiple of 400. The method does not always work correctly public boolean isLeapYear(int val) if ((val 4) == 0) return true; else return (val & 400) == 0; Which of the following method calls will return an incorrect response?
A .isLeapYear (1900)
B. isLeapYear (1984)
C. isLeapYear (2000)
D. isLeapYear (2001)
E. isLeapYear (2010)

Answers

Answer:

.isLeapYear (1900) will return an incorrect response

Explanation:

Given

The above method

Required

Which method call will give an incorrect response

(a) will return an incorrect response because 1900 is not a leap year.

When a year is divisible by 4, there are further checks to do before such year can be confirmed to be a leap year or not.

Since the method only checks for divisibility of 4, then it will return an incorrect response for years (e.g. 1900) that will pass the first check but will eventually fail further checks.

Hence, (a) answers the question;

Which XXX declares a student's name. public class Student { XXX private double myGPA; private int myID; public int getID() { return myID; } } Group of answer choices String myName; public String myName; private myName; private String myName;

Answers

Question:

Which XXX declares a student's name.

public class Student {

   XXX

   private double myGPA;  

   private int myID;

   public int getID() {

        return myID;

   }

}

Group of answer choices

a. String myName;

b. public String myName;

c. private myName;

d. private String myName;

Answer:

private String myName;

Explanation:

To declare a student's name, the following should be noted.

i. The name of the student is of type String

ii. Since all of the instance variables (myGPA and myID) have a private access modifier, then myName (which is the variable name used to declare the student's name) should be no exception. In other words, the student's name should also have a private access.

Therefore, XXX which declares a student's name should be written as

private String myName;

Option (a) would have been a correct option if it had the private keyword

Option (b) is not the correct option because it has a public access rather than a private access.

Option (c) is not a valid syntax since, although it has a private access, the data type of the variable myName is not specified.

Option (d) is the correct option.

Other Questions
Jacqui likes to travel to the beach on weekends. She starts at her house, drives d miles, and then spends t hours walking the remaining w miles to get to the beach. Jacqui drives three times as long as she walks during the trip. The equation below represents Jacqui's average speed, a, in miles per hour, when traveling to the beach. a=d+w/3t+t What is the meaning of 3t + t3t+t in the equation above? -The total time that Jacqui spends traveling to the beach -The time that Jacqui spends driving to the beach -The total distance that Jacqui travels to the beach -Jacqui's maximum speed during her trip Jacqui's average speed during one trip to the beach was 3636 miles per hour. If Jacqui drove 70 miles and the entire trip to the beach took her 22 hours, how many miles did she walk to get to the beach? 15. The movement of molecules in a fluid or gas from a region of higherconcentration to a region of lower concentration is called: The function C(x) = 400x - 0.2x ^ 2 represents the total costs for a company to produce a product, where in dollars and x is the number of units sold. Which statement is true? is the total cost What is the value of n? 14cm and 31cm and 34cm equal Item 7Which indirect object pronoun correctly completes the sentence?Luis da flores a Raquel.Luis ______ da flores.teleselavv This graph represents a population of molecules in a gas versus the distribution of the average velocity(speed) of its molecules in that population. Assume all molecules to be of the same mass. In reading the graph, it is important to note three things. One, is the most probable speed is at the peak of the curve. Secondly, the most probable speed increases as the temperature increases (so shift to the right), and the distribution broadens as it increases.On the graph, indicate the average kinetic energy of the population.Explain your answer.What part of the graph indicates the temperature of the sample?Explain your answer.Sketch a curve that represents the distribution of molecules at a temperature below the one shown. Label it as T2. Describe both T and T2 in terms of their average kinetic energy. Be specific and detailed.Submit your answer below. _________ is the study of processes and patterns involved in the design and creation of products. Mathematics Science Technology Engineering An aquarium holds 11.81 cubic feet of water, and is 2.8 feet long and 1.7 feet wide. What is its depth? Round your answer to the nearest whole number. What are three benefits of vertical farming that provide an advantage over horizontal farming. Write the word sentence as an inequality.3.2 less than a number t is at most 7.5 PLEASE SOMEONE HELP ME I WILL GIVE BRAINLIEST PLEASE HELP! Math (recursive sequences) How did Martin Luther King, Jr. react to the arrest of Rosa Parks? 1He called for people to give money to Rosa Parks's defense team.2He called for the people of Montgomery, Alabama to boycott all city buses.3He called for the segregation of all Montgomery, Alabama city buses. 33. Given the following algebraic expression 5x + 10 Which statement is true?a. The coefficient is 5b. The constant is 2C. The power is 10d. The constant is 5 How does the direction of light affect photos? find the points on the y-axis, each of which is at a distance of 13 units from the point (-5,7) Anyone know any good books to study exam style questions for 9th grade biology? 18.Which of the following are the coordinates of the vertex of y= x2 - 10x + 2?A. (5, 23)B. (10, 2)C. (5, 23)D. (2, 10) I dont understand this equation. m= -3 and b = 3