Question

In: Computer Science

1. What does is mean when a decision structure uses negative logic?

1. What does is mean when a decision structure uses negative logic?

2. Demonstrate how this would be in implemented in a python code snippet (a snippet is just a partial part of the program and not the entire program).

Solutions

Expert Solution

Answer 1:

There are three types of decision logic: straight through logic, positive logic, and negative logic.

Negative logic allows the flow of the processing to continue through the module instead of processing succeeding decisions, once the resultant of a decision is False. Whenever the resultant is False (the Else part of the decision), another decision in the sequence is processed until the resultant is True, or there are no more decisions to process.

Decisions using negative logic use nested If/Then/Else instructions.

Answer 2:

Implementation in a python code snippet:

sales = 10000

if sales>2000:

if sales>4000:

if sales>6000:

commission = 0.1

else:

commission = 0.05

else:

commission = 0.04

else:

commission = 0.03

print(commission)


Related Solutions

What does a negative EC50 mean?
What does a negative EC50 mean?
Q. What does it mean when we say a data structure is dynamic?
Q. What does it mean when we say a data structure is dynamic?Its size in memory is fixed.It contains functions for operating on the data it contains.Its behavior changes in response to its environment.It is capable of expanding and contracting as data is added and removed.Q. If we had a class named MapData, how would we declare its destructor?delete[] MapData();destructor* MapDataDestructor();NULL_PTR this->MapData();~MapData();Q. When traversing a singly-linked list with a dummy header node, where do we begin the traversal pointer?At element...
What does it mean to be a proxy decision-maker?
What does it mean to be a proxy decision-maker?
What does it mean when your schedule has negative float? If you are the Project Manager...
What does it mean when your schedule has negative float? If you are the Project Manager or lead scheduler, what are your options to deal with negative float?
What does it mean when two (or more) compounds have a net negative (exothermic) energy of...
What does it mean when two (or more) compounds have a net negative (exothermic) energy of mixing?
What does Darwin mean when he says that natural selection will change the structure of the...
What does Darwin mean when he says that natural selection will change the structure of the young in relation to the parent, and of the parent in relation to their young? Is this talking about social features of an animal? -Based on Darwin, The Origin of Species
What does it mean when a cost-capacity factor is less than 1? What does it mean...
What does it mean when a cost-capacity factor is less than 1? What does it mean when it is greater than 1?
what does network mean in polymer structure ?
what does network mean in polymer structure ?
1.HPY is negative does not mean that ending value of the investment is negative Select one:...
1.HPY is negative does not mean that ending value of the investment is negative Select one: True False 2.Nominal Risk Free Rate investment is one which has one possible return which has a probability of 1.0 True False 3.Some types of life insurance policy payments contribute towards increasing the amount of money you have for your retirement years Select one: True False
1. What does it mean in Greek? When was it first used?
1. What does it mean in Greek? When was it first used?2. What is the difference between how the early Greeks used the term atomand how it is used today?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT