1answer.
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
Yuri [45]
3 years 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:
dmitriy555 [2]3 years ago
3 0

Answer:

function getDay(s, k){

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

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

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

}

Explanation:

//this functions receive the next parameters:

//s which is the day of the week

//k the number of days after s week day

function getDay(s, k){

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

//variable index is the index in list weekDays of s

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

//use module operator % to get the remainder of the division (index+k)/7

//return the string value of the day

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

}

You might be interested in
Who watches the show gravity falls, if you do, if you play the theme song for the first episode backwards you get a hiding messi
Yakvenalex [24]
I don’t really knowwww but thanks
4 0
2 years ago
Read 2 more answers
Largest of five (5 points). Write an algorithm that read 5 distinct integers and displays the largest value. Assume the input va
mrs_skeptik [129]

Answer:

import java.io.*;

public class Larger {

  public static void main(String[] args) throws IOException{

       BufferedReader br=new BufferedReader(new InputStreamReader(System.in));// reading input from buffered reader

        int a,max=-99999,i;

        for(i=1;i<=5;i++)

        {

            a=Integer.parseInt(br.readLine());//converting string input string to int

            if(a >max)

               max=a;

         

        }

       System.out.println("Maximum value : "+max);

  }

Explanation:

6 0
3 years ago
The set of three integer values for the lengths of the sides of a right triangle is called a Pythagorean triple. These three sid
Sloan [31]

Answer:

In Python:

def  Pythagorean_triple(hyp,side1,side2):

   if hyp**2 == side1**2 + side2*2:

       return True

   else:

       return False

               

print("Hypotenuse\tSide 1\t Side 2\t Return Value")

for i in range(1,501):

   for j in range(1,501):

       for k in range(1,501):

           print(str(i)+"\t"+str(j)+"\t"+str(k)+"\t"+str(Pythagorean_triple(i,j,k)))

Explanation:

This defines the function

def  Pythagorean_triple(hyp,side1,side2):

This checks for pythagorean triple

   if hyp**2 == side1**2 + side2*2:

Returns True, if true

       return True

   else:

Returns False, if otherwise

       return False

               

The main method begins

This prints the header

print("Hypotenuse\tSide 1\t Side 2\t Return Value")

The following is a triple-nested loop [Each of the loop is from 1 to 500]

for i in range(1,501): -->The hypotenuse

   for j in range(1,501): -->Side 1

       for k in range(1,501):-->Side 2

This calls the function and prints the required output i.e. the sides of the triangle and True or False

           print(str(i)+"\t"+str(j)+"\t"+str(k)+"\t"+str(Pythagorean_triple(i,j,k)))

8 0
2 years ago
A file with a com extension is most likely to be a(n) ___ file.
olasank [31]
I think that the answer is: A executable
4 0
3 years ago
Read 2 more answers
Computer system with a 32-bit logical address and 4k-byte page size. assume that each entry of a page table consists of 4bytes.
Annette [7]

The number of bits in the physical address is 26 bits. The number of entries in a page table is \mathbf{2^{20}} entries. The size of the page table in a one-level paging scheme is 4MB.

<h3>
What is paging in Operating System?</h3>

Paging is a storage method used in operating systems to recover activities as pages from secondary storage and place them in primary memory. The basic purpose of pagination is to separate each procedure into pages.

We are given the following parameters:

  • 32-bit logical address
  • Page size = 4 KB = \mathbf{2^{12} \ bytes }
  • Size of each Page table entry = 4 bytes

Suppose the system supports physical memory size = 64 MB = \mathbf{2^{26} \ bytes}

Thus, the number of bits in the physical address is computed as:

= \mathbf{log_2 \{Physical-memory-size\}}

=\mathbf{log_2(2^{26})}}

= 26 bits

The number of entries in a page table = logical address space size/page size

The number of entries in a page table \mathbf{= \dfrac{2^{32}}{2^{12}}}

\mathbf{=2^{20}} entries

In a one-level paging scheme, the size of the table is:

= entire no. of page entries × page table size

= \mathbf{2^{20}\times 4 \ bytes}

= 4 MB

b.

suppose that this system supports up to 2^30 bytes of physical memory.

  • The size of the page table will be the same as 4 MB due to the fact that the number of entries, as well as, the page table entry size is the same.

Since the size of the page table surpasses that of a single page. A page cannot include a whole page table. Therefore, the page table must be broken into parts to fit onto numerous pages, and an additional level of the page table is required to access this page table.

  • This is called the Multi-Level Paging system.

Therefore, we can conclude that the number of bits in the physical address is 26 bits, the number of entries in a page table is \mathbf{2^{20}} entries, and the size of the page table in a one-level paging scheme is 4MB.

Learn more about Paging in Operating System here:

brainly.com/question/17004314

#SPJ1

4 0
1 year ago
Other questions:
  • Write thanks to the IT teacher at the end of grade 5
    7·1 answer
  • Which measure should you take for the periodic maintenance of your computer? You need to invest in a for_______________ the peri
    15·2 answers
  • If you glare and grit your teeth while telling your friend that you're not frustrated, your nonverbal communication is _________
    6·1 answer
  • Select the correct answer.
    13·1 answer
  • Recursion is a natural use for a _____ (stack or queue)
    13·1 answer
  • How does netbios identify a computer system on the network?
    13·1 answer
  • Why are computers useful for modeling situations?
    13·2 answers
  • Your project will require a 7-day work week rather than the traditional 5-day. How can you adapt the software to this new schedu
    15·1 answer
  • What do you mean by HDML coding ​
    13·1 answer
  • One of 34 possible _________________ can be assigned to each axis of classification in the seven-character code.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!