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
Sergio039 [100]
3 years ago
5

Create an array of 10 fortune cookie sayings that will be randomly displayed each time the user reloads the page. The fortune wi

ll be sayings like: "Procrastination is the thief of time." Let the visitor get a new fortune when a button is clicked. g
Computers and Technology
1 answer:
vfiekz [6]3 years ago
4 0

Answer:

let cookieNumber = Math.floor(Math.random() * 10)

switch (cookieNumber) {

  case 1:

   document.write('Fortune 1')

   break;

  case 2:

   document.write('Fortune 2')

   break;

   case 3:

   document.write('Fortune 3')

   break;

  case 4:

   document.write('Fortune 4')

   break;

  case 5:

   document.write('Fortune 5')

   break;

  case 6:

   document.write('Fortune 6')

   break;

  case 7:

   document.write('Fortune 7')

   break;

  case 8:

   document.write('Fortune 8')

   break;

  case 9:

   document.write('Fortune 9')

   break;

  case 10:

   document.write('Fortune 10')

Explanation:

The cookieNumber is generated using Math.random(), which is rounded to a whole number using Math.floor(). Then, a switch block is used to display a different fortune depending on the value of cookieNumber.

You might be interested in
The application layer in the tcp/ip protocol suite is usually considered to be the combination of ________ layers in the osi mod
navik [9.2K]
Application Presentation and Session Layers.
8 0
3 years ago
Write a method that takes a Regular Polygon as a parameter, sets its number of sides to a random integer between 10 and 20 inclu
Fantom [35]

Answer:

Answered below

Explanation:

//Program is written in Java programming language

Class RegularPolygon{

int sides = 0;

int length = 0;

}

public void randomize(RegularPolygon polygon){

int randomSides = (int) 10 + (Math.random() * 20);

double randomLength = 5 + (Math.random() * 11);

polygon.sides = randomSides;

polygon.length = randomLength;

}

8 0
3 years ago
In order to look up ipv4 and ipv6 dhcp leases, what two files should be viewed?​
Zigmanuir [339]
The answers are  /var/lib/dhcpd/dhcpd.leases   &                                                                       /var/lib/dhcpd/dhcpd6.leases
In order to look up ipv4 and ipv6 dhcp leases, The two files that should be viewed are  /var/lib/dhcpd/dhcpd.leases &  /var/lib/dhcpd/dhcpd6.leases                                             
7 0
3 years ago
What is a close syllable
Tasya [4]
A closed syllable<span> is a </span>syllable<span> that ends with a consonant. The words fan, am, and left have </span>closed syllables<span>. Multi-syllabic words have </span>closed syllables<span> too. For example, a two-</span>syllable<span> word with the vowel-consonant-consonant-vowel pattern may have one or two </span>closed syllables<span>.</span>
5 0
2 years ago
Read 2 more answers
To print the last element in the array named ar, you can write :A. System.out.println(ar.length);
timofeeve [1]

Answer:

Option (d) is the correct answer.

Explanation:

An Array is used to store multiple variables in the memory in the continuous memory allocation on which starting index value is starting from 0 and the last index value location is size-1.

In java programming language the array.length is used to tells the size of the array so when the user wants to get the value of the last element, he needs to print the value of (array.length-1) location so the correct statement for the java programming language is to print the last element in the array named ar is--

System.out.println(ar[ar.length-1]);

No option provides the above statement, so option d (None of these) is correct while the reason behind the other option is not correct is as follows--

  • Option a will prints the size of the array.
  • Option b also gives the error because length is an undeclared variable.
  • Option c will give the error of array bound of an exception because it begs the value of the size+1 element of the array.
3 0
3 years ago
Other questions:
  • If you purchase a software suite for personal use, you can install the software how many times on how many different machines?
    6·1 answer
  • An effective team would never have​
    9·1 answer
  • Complete the paragraph to explain how Angelina can notify readers that her report is just a draft.
    6·1 answer
  • You can use this effect to break a color into a percentage of its full strength.
    13·1 answer
  • Define the missing method. licenseNum is created as: (100000 * customID) licenseYear, where customID is a method parameter. Samp
    14·2 answers
  • The user does not need to highlight data within an Excel worksheet in order to remove conditional formatting. True or false
    14·1 answer
  • What is Brainly?<br><br> A.Yes<br> B.No
    12·2 answers
  • Each Google My Business location has a unique ID that applies changes to the right listing.
    11·1 answer
  • Henry has created a software product that manages a database of company clients. He wants to install the software on a client's
    13·1 answer
  • I have crummy WiFi and a bad pc. If I get a gaming computer, will it improve my FPS or ping?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!