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]
2 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]2 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
Why do bats sleep upside down
seraphim [82]

Answer:

Bats cannot run so it would be almost impossible for them to take off from the ground. A major advantage to hanging upside down is that bats do not need to generate lift to begin flight. They just drop out of their bed, open their wings and off they go.

Explanation:

8 0
2 years ago
What does it mean "Be Proactive"?
joja [24]

Answer:controlling a situation by making things happen or by preparing for possible future problems

Explanation:

4 0
2 years ago
Read 2 more answers
Which of these statements performs real number quotient division using type casting?
lara [203]

Answer:

Double x = 35 / 10;

Explanation:

Java provides simple data types for representing integers, real numbers, characters, and Boolean types. These types are known as _ or fundamental types.

<3

3 0
2 years ago
Are commonly used to control the number of times that a loop iterates?
pickupchik [31]
Hmm... I feel like this query is much broader than it should be. However, I will start my initial answer, then another potential solution.

My initial answer to your query was: A condition controlled loop is used to control the number​ of times a loop iterates.

The potential answer, my secondary one, is: A count controlled loop iterates a specific number of times.

Two results, but my initial answer is the solution I opted when understanding this.
5 0
2 years ago
Write a filter that reads in a sequence of integers and prints the integers, removing repeated values that appear consecutively.
lara31 [8.8K]

Answer:

Following is the code for filter:

public class filter

{ public static void main(String[] args)

{ int x = StdIn.readInt();

System.out.print(" " + x + " ");

while(!StdIn.isEmpty())

{ int y = StdIn.readInt();

    if(y != x)

          System.out.print(" " + y + " ");

    x = y;

    }

    }

    }

Explanation:

  • A public class filter is used.
  • The main function will accept a single argument as string[], it is also known as java command line argument.
  • Now the Stdln.readInt is used to read the integers in the sequence and store it in integer x.
  • The value stored in variable x will be printed using System.out.print
  • Now unless the Stdln.readInt gets an empty value, check each value of sequence and store in variable y.
  • If y is not equal to previous value x, print it and shift the value of y into x.
  • Repeat the loop again.

i hope it will help you!

7 0
3 years ago
Read 2 more answers
Other questions:
  • Which sparkline type is best for displaying trends in data changes over time?
    11·1 answer
  • Using the merge method of the Map interface, which statement correctly updates the salesTotalByDept map of type Map to update th
    7·1 answer
  • _____ can render data useless to unauthorized users who might have violated some of the database security layers.
    7·1 answer
  • Why when I move stuff in Roblox Studio like an object or a Character. It tilts the opposite direction I'm moving it to with the
    6·2 answers
  • A company has critical systems that are hosted on an end-of-life OS. To maintain operations and mitigate potential vulnerabiliti
    14·1 answer
  • You are troubleshooting a client connectivity problem on an Ethernet network. The client system has intermittent connectivity to
    9·1 answer
  • Can someone find out what this binary number thing is. Just find out the message, I'm having a difficult time
    13·1 answer
  • Which of the following describe audio-editing software? Choose all that apply.
    5·2 answers
  • he wants to customize the operating system to meet his needs. what types of tools should he use, and what can he do with each?
    6·1 answer
  • How to do or create a shepard tone using additive synthesis in Pure Data. Please help, desperate!!
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!