Consider the following code segment, which is intended to simulate a random process. The code is intended to set the value of the variable event to exactly one of the values 1, 2, or 3, depending on the probability of an event occurring. The value of event should be set to 1 if the probability is 70 percent or less. The value of event should be set to 2 if the probability is greater than 70 percent but no more than 80 percent. The value of event should be set to 3 if the probability is greater than 80 percent. The variable randomNumber is used to simulate the probability of the event occurring.
int event = 0;
if (randomNumber <= 0.70)
{
event = 1;
}
if (randomNumber <= 0.80)
{
event = 2;
}
else
{
event = 3;
}
The code does not work as intended. Assume that the variable randomNumber has been properly declared and initialized. Which of the following initializations for randomNumber will demonstrate that the code segment will not work as intended?
A) randomNumber = 0.70;
B) randomNumber = 0.80;
C) randomNumber = 0.85;
D) randomNumber = 0.90;
E) randomNumber = 1.00;

Answers

Answer 1

Answer:

A) randomNumber = 0.70;

Explanation:

The code works perfectly for all values of randomNumber given in the options except option (a)

This is so because:

The first condition

if (randomNumber <= 0.70)  {  event = 1;  }

It checks if randomNumber is less than or equal to 0.70. This is true, so event is set to 1.

However, the next condition after it will also be executed because it is a different conditional to be executed.

So, we have:

if (randomNumber <= 0.80)  {  event = 2;  }

This condition is also true, so event is set to 2.

From the question randomNumber is meant to be event 1. However, this is different from the result of executing the code.

Hence, (a) is true


Related Questions

What are some study habits that you practice? Check all that apply.
studying with friends
studying on a regular schedule
taking breaks while studying
getting good sleep
studying in a quiet area

Answers

Answer:

studying in quiet place

Taking breaks

Reading from notes

good sleep

eating healthy foods

group study

studying on regular schedule

revision

Some study habits that you should practice are studying with friends, studying on a regular schedule, taking breaks while studying, getting good sleep, and studying in a quiet area. All options are correct.

What are good studying habits?

Effective study techniques can be used by someone who wants to get good scores. Summarizing, limiting distractions, taking breaks, and memorization are some good study techniques.

Several good study practices include: When studying, summarize your notes, avoid studying when you're sleepy, memorize your notes, limit distractions, and take breaks.

Study habit is an action such as reading, taking notes, holding study groups which the students perform regularly and habitually in order to accomplish the task of learning.

Therefore, the correct options are a, b, c, d, and e.

To learn more about studying habits, refer to the link:

https://brainly.com/question/14735769

#SPJ5

What is IP address ?explain​

Answers

Answer:

An IP address is a unique address that identifies a device on the internet or a local network. IP stands for "Internet Protocol," which is the set of rules governing the format of data sent via the internet or local network.

Explanation:

IP addresses provide a way of doing so and form an essential part of how the internet works.

Answer: An Internet Protocol address is a number which is unique to. each device connected to the label. It is used for identification and location.  

Explanation:

what is the use of printer​

Answers

Answer:

To print stuff

Explanation:

Answer:

well um

Explanation:

ummmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

to print things (⌐■_■)

What were Roman Capitals first used for?

Answers

Answer:

Square capitals were used to write inscriptions, and less often to supplement everyday handwriting. When written in documents this style is known as Latin book hand. For everyday writing the Romans used a current cursive hand known as Latin cursive. Notable examples of square capitals used for inscriptions are found on the Roman Pantheon, Trajan's Column, and the Arch of Titus, all in Rome. Square capitals are characterized by sharp, straight lines, supple curves, thick and thin strokes, angled stressing and incised serifs. These Roman capitals are also called majuscules, as a counterpart to minuscule letters such as Merovingian and Carolingian.

used to write inscriptions

45. Our goals are a reflection of our:
O values
O standards
O obstacles
O resources
beliefs
values and beliefs

Answers

Values hope it helps you

Suppose we are now working with memory words of length 8. We have already calculated that we need 4 check bits, and the length of all codewords will be 12. We now receive the following code word: 0 1 0 1 1 1 0 0 1 1 1 1 Is this a legal codeword, assuming even parity? If not, where is the error?

Answers

Answer:

12

Explanation:

and it is also an error

Can software work without Hardware? Why?

Answers

Answer:

No

Explanation:

Software requires hardware to run. Think about a computer, you can't have windows without having the computer. Software is programmed to run on hardware.

Write a program that reads a file called 'test.txt' and prints out the contents on the screen after removing all spaces and newlines. Punctuations will be preserved. For example, if 'test.txt' contains: This is a test file, for chapter 06. This a new line in the file! Then, your program's output will show: Thisisatestfile,forchapter06.Thisanewlineinthefile! Hint: Consider using the 'strip()' and 'replace()' functions.

Answers

Answer:

I don't know  you should figure that out good luck

Explanation:

good luck

Use the drop-down menus to complete the sentences about the Calendar view Arrange command group.


Under the Calendar view, you will see your calendar as

by default.


When you create an appointment, you are creating an activity that will not send

to other people.


A meeting is an activity where individuals are invited and

are shared.



is an all-day incident placed on the calendar.

Answers

Answer:

Use the drop-down menus to complete the sentences about the Calendar view Arrange command group.

Under the Calendar view, you will see your calendar as  

✔ monthly

by default.

When you create an appointment, you are creating an activity that will not send  

✔ an invitation

to other people.

A meeting is an activity where individuals are invited and  

✔ resources

are shared.

✔ An event

is an all-day incident placed on the calendar.

Explanation:

edge 2021

The complete sentences about the calendar view arrange command group are as follows:

Under the Calendar view, you will see your calendar as monthly by default. When you create an appointment, you are creating an activity that will not send an invitation to other people.A meeting is an activity where individuals are invited and resources are shared. An event is an all-day incident placed on the calendar.

What do you mean by Calender view?

Calendar view may be characterized as a type of feature within calendar software in which the user can choose from various formats in order to view the calendar more accurately and interestingly.

A calendar view lets a user view and interacts with a calendar that they can navigate by month, year, or decade. A user can select a single date or a range of dates. It doesn't have a picker surface and the calendar is always visible.

Command and control functions are performed through an arrangement of personnel, equipment, communications, facilities, and procedures employed by a commander in order to execute its functions.

Therefore, the complete sentences about the calendar view arrange command group are well mentioned above.

To learn more about Calendar view, refer to the link:

https://brainly.com/question/17524242

#SPJ2

You are working with a client who wants customers to be able to tap an image and see pricing and availability. As you are building the code in Java, what will you be using?


graphical user interface

icon public use

graphical public use

icon user interface

Answers

Answer:

A. Graphical user interface

Explanation:

In Java the graphical user interface is what manages interaction with images.

Answer: A.)

Explanation:

The answer is A because

I was born to rule the world

And I almost achieved that goal

(Giovanni!)

But my Pokémon, the mighty Mewtwo,

Had more power than I could control

(Giovanni!)

Still he inspired this mechanical marvel,

Which learns and returns each attack

(Giovanni!)

My MechaMew2, the ultimate weapon,

Will tell them Giovanni is back!

There'll be world domination,

Complete obliteration

Of all who now defy me.

Let the universe prepare,

Good Pokémon beware,

You fools shall not deny me!

Now go, go, go, go!

It will all be mine,

Power so divine

I'll tell the sun to shine

On only me!

It will all be mine,

Till the end of time

When this perfect crime

Makes history

Team Rocket! This is our destiny!

Listen up, you scheming fools,

No excuses, and no more lies.

(Giovanni!)

You've heard my most ingenious plan,

I demand the ultimate prize

(Giovanni!)

Now bring me the yellow Pokémon

And bear witness as I speak

(Giovanni!)

I shall possess the awesome power

In Pikachu's rosy cheeks!

There'll be world domination,

Complete obliteration

Of all who now defy me.

Let the universe prepare,

Good Pokémon beware,

You fools shall not deny me!

Now go, go, go, go!

It will all be mine,

Power so divine

I'll tell the sun to shine

On only me!

It will all be mine,

Till the end of time

When this perfect crime

Makes history

Team Rocket! This is our destiny!

To protect the world from devastation

To unite all peoples within our nation

To denounce the evils of truth and love

To extend our reach to the stars above

Jessie!

James!

There'll be total devastation,

Pure annihilation

Or absolute surrender.

I'll have limitless power,

This is our finest hour

Now go, go, go, go!

In the early days of the Internet, most access was done via a modem over an ________.
Question 10 options:

Analog telephone line

Fax

Telegram

None of the above

Answers

Answer:

analog telephone line

Explanation:

I hope this helps! :)

☁️☁️☁️☁️☁️☁️☁️☁️☁️

ERIC'S Company sells cement at 30.0 Ghana Cedis per bag. The company

however gives discount of 15% for customers that buy 100 or more bags, and 0% for

customers that buy less than 100 bags.
Write a pseudo code and present a flowchart that

will display the discount percentage when the quantity of bags purchased is entered.​

Answers

Answer:

The pseudocode is as follows:

Input Quantity

Discount = 0%

If Quantity >= 100:

    Discount = 15%

Print Discount

See attachment for flowchart

Explanation:

This line gets the quantity from the user

Input Quantity

This line initializes the discount to 0%

Discount = 0%

This checks if quantity is more than or equal to 100

If Quantity >= 100:

If yes, discount is set to 15%

    Discount = 15%

This prints the discount percentage

Print Discount

See attachment for flowchart

BitTorrent, a P2P protocol for file distribution, depends on a centralized resource allocation mechanism through which peers are able to maximize their download rates.
True or False?

Answers

Answer:

yes. it is true. mark as brainlest

Other Questions
Im not smart - help. I will select brainliest Can this be reduced? Mendels pea plants had either purple or white flowers. This means that the plantsThe answer is C: have two alleles for the gene. I NEED HELP ASAP!!! I CAN GIVE BRIANLIST!!! Adele believes that 0.462 is written as "four tenths, sixty-two hundredths." Is she correct? Explain your answer. * Thor made 45 gallons of of punch. The recipe he followed called for 7/9 of the punch to be orange juice. How many gallons of orange juice did Thor use to make the punch EXERCISE 1.201. In the number 53.436. how many times is the place value of the digit 3 to the rightof the digit 4 to that of the digit 3 to the left of the digit 4? As part of the initial investment, Jackson contributes accounts receivable that had a balance of $25,581 in the accounts of a sole proprietorship. Of this amount, $1,347 is deemed completely worthless. For the remaining accounts, the partnership will establish a provision for possible future uncollectible accounts of $807. The amount debited to Accounts Receivable for the new partnership is a.$25,581 PROSZ EBY KTO ZROBI TE ZADANIE Z NIEMIECKIEGO KOLEJNY RAZ DAJE T ZADANIE I ZGOSZ JAKIEGO TYPA CO DA MI Z ODPOWIED An author's tone is his or her A. political philosophy. B. educational background. C. attitude toward the work. D. purpose for writing the work. sin 68 = 70/wfind w Can someone help me thx Use the following function rule to find f(1).f(x) =4(4)4^x+1f(1)=....... four characteristics of Populism. The cake Hugo made for my birthday wasthan the one I made for his, but I put more icing on the one I madeWhich wordphrase best completes the sentence above?moister,most moistOCmore moistODmoistest 8Express sin A, cos A, and tan A as ratios.12613 5.65 x 10 to the 5th power + 4.87 * 10 to the 3rd power A friend of yours left a pile of mail on a table. You notice your favorite magazine sticking out from under a package. You grab the magazine by its corner and get it from under the package. As you get your magazine, the package does not topple becauseA- it has no accelerationB-the force of gravity keeps it secured C-it has inertia D- a pair of action-reaction forces act on it PLSSSSSSS HELPPPPPPP I WILL GIVE BRAINLIESTTTTTTTTTT!!!!!!!!!!!!!!!!!!!!!PLSSSSSSS HELPPPPPPP I WILL GIVE BRAINLIESTTTTTTTTTT!!!!!!!!!!!!!!!!!!!!!PLSSSSSSS HELPPPPPPP I WILL GIVE BRAINLIESTTTTTTTTTT!!!!!!!!!!!!!!!!!!!!!PLSSSSSSS HELPPPPPPP I WILL GIVE BRAINLIESTTTTTTTTTT!!!!!!!!!!!!!!!!!!!!!PLSSSSSSS HELPPPPPPP I WILL GIVE BRAINLIESTTTTTTTTTT!!!!!!!!!!!!!!!!!!!!!PLSSSSSSS HELPPPPPPP I WILL GIVE BRAINLIESTTTTTTTTTT!!!!!!!!!!!!!!!!!!Under what conditions was Stephen A. Austin allowed to start a colony in Texas? 31. Women can handle more alcohol than men due to their weight and structureTRUE FALSE32. Alcohol narrows your blood vesselsTRUE FALSE33. People can develop a tolerance to nicotine, marijuana, and alcohol.TRUE FALSE