answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
asambeis
2 months ago
14

Days of the week are represented as three-letter strings ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"). Write a javaScript f

unction solution that, given a string S representing the day of the week and an integer K (between 0 and 500), returns the day of the week that is K days later. For example, given S = "Wed" and K = 2, the function should return "Fri". Given S = "Sat" and K = 23, the function should return "Mon".
Computers and Technology
1 answer:
Harlamova29_29 [1K]2 months ago
3 0

Answer:

function getDay(s, k) {

var weekDays = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];

var index = weekDays.findIndex(function(day) { return day === s; });

return weekDays[(index + k) % 7];

}

Explanation:

// This function takes two parameters:

// s: a string representing the current day of the week

// k: an integer indicating how many days after s to find the result

function getDay(s, k) {

var weekDays = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];

// Find the index of day s in weekDays array

var index = weekDays.findIndex(function(day) { return day === s; });

// Calculate the new index by adding k and using modulo 7 to wrap around

return weekDays[(index + k) % 7];

}

You might be interested in
Rewrite following program using for loop no=3456 while no>0 : print(no%10) no=no/10
zubka84 [1067]
no=3456 for x in reversed(str(no)): print(x) If you convert the number to a string and reverse it, you will obtain the same outcome.
8 0
1 month ago
Read 2 more answers
Su now wants to highlight several inventors in her presentation, so she decides to use the underline color option.
Harlamova29_29 [1022]

Answer:

1. The home tab

2. Font group

3. The small arrow at the bottom right of the font command group.

4. Under "Font" heading (then "All text" subheading)

Explanation:

This explanation will guide Su in completing her task.

1. Navigate to the home tab;

2. From the home tab, Su will access a variety of command groups, but for her needs, she requires the Font command group.

3. A tiny arrow can be found at the bottom left of the font command group section; clicking it will unveil the font dialogue.

4. Within the font dialogue, there are two headings. The "font" heading and the "character spacing" heading.

For her purposes, she must focus on the "Font" heading, which includes various subheadings. To reach the underline color option, she needs to select the "All text" subheading.

Refer to the attached image for guidance.

7 0
1 month ago
The video clip on driverless cars explained that brain signals from the individual wearing the headset are converted by computer
zubka84 [1067]

There is a safety concern if the vehicle experiences a malfunction or encounters a red light or police; just operate your own vehicle instead.

5 0
2 months ago
Read 2 more answers
Your employer, yPlum Corporation is manufacturing two types of products: Mirabelle smartphone, and Blackamber laptop. The compan
Natasha_Volkova [1026]

Answer:

Refer to the explanation

Explanation:

Number of Mobiles=x1

Number of Workstations=x2

Constraints:

50x1 + 70x2 <= 1,60,000

250x1 + 700x2 <= 12,000,000

x1 >= 0 x2 >= 0

Objective function N(x1, x2) = 7800000000 x1 + 7200000000 x2

Excel formulae:

G17 = D9 * E7 + F9 * G7

G18= D10 * E7 * F10 * G7

G19= E7

G20= G7

G21= I17 * E7 + I18 * G7 (This will yield the Maximum)

And E7 and G7 will be the solution.

Set up your sheet as shown in the diagram and apply the formulas.

Access the tool and select solver. Upon opening the Solver dialog, confirm ‘Assume Linear model’ and ‘assume non-negative’. Click to solve the model and keep the solution.

7 0
29 days ago
To keep from overwriting existing fields with your Lookup you can use the ____________ clause.
ivann1987 [1066]
<span>I propose the term <span>outputnew
</span>The key distinction between output new and output is that outputnew will not overwrite the existing description field.
Should you omit this clause, <span>Splunk will add all field names and values to your events via the lookup.</span></span>
3 0
1 month ago
Read 2 more answers
Other questions:
  • Describe how the process of sampling, RGB pixels, and binary sequences work together to display a digital color image
    14·1 answer
  • Which of the following is true of how computers represent numbers?
    9·2 answers
  • Define a new object in variable sculptor that has properties "name" storing "Michelangelo"; "artworks" storing "David", "Moses"
    12·1 answer
  • The position of a runner in a race is a type of analog data. The runner’s position is tracked using sensors. Which of the follow
    8·1 answer
  • The piston engine uses the ________ to convert the reciprocating motion of the piston into rotary motion.
    13·1 answer
  • What feature would be used to collect how many times users downloaded a product catalog?
    11·1 answer
  • Define a public static method named f2s that takes a single String argument, the name of a file. The method returns a (concievab
    13·1 answer
  • Run a Monte Carlo simulation on this vector representing the countries of the 8 runners in this race:
    7·1 answer
  • The act of infiltrating a remote computer system is called​
    14·1 answer
  • Write a function in the cell below that iterates through the words in file_contents, removes punctuation, and counts the frequen
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!