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
yarga [219]
3 years ago
5

Write the definition of a function isPositive, that receives an integer parameter and returns true if the parameter is positive,

and false otherwise. So, if the parameter's value is 7 or 803 or 141 the function returns true. But if the parameter's value is -22 or -57, or 0, the function returns false.
Mathematics
1 answer:
Svetach [21]3 years ago
8 0

Answer:

BEGIN def function isPositive(int parameter)

//test for positivity

if parameter > 0

RETURN true

else

RETURN  false

END def function isPositive

Step-by-step explanation:

A number is a positive integer if it is a whole number and exists between 0 and positive infinity e. g 1, 90000, 42434234 e.t.c. It is a negative integer if it is a whole number and exists between negative infinity and 0(0 may be inclusive). e.g 0, -34342, -6984.

As shown on the first line, to define a function, we begin by writing the name of the function - "isPositive" in this case - followed by a pair of parenthesis which contains the parameter(s) on which the function will act on. In this case, the parameter is an integer - positive or negative.

Line 2 shows a comment describing what happens on the next four lines. i.e  checking whether or not the parameter's value is positive

Then, we write an if-else statement to check whether or not the parameter's value is a positive integer. If the parameter's value is greater than 0, the parameter's value is thus a positive integer then the function will return true. This is shown on lines 3 and 4. Otherwise, the parameter's value is a negative integer, thus the function returns a false as shown on lines 5 and 6.  

The last line in the expression shows the end of the function's definition.

Hope it helps.

You might be interested in
Simplify the expression 111,000*0.072 using scientific notation and express your answer in scientific notation.
Gemiola [76]

Answer:

7.992 × 10 ^3

Step-by-step explanation:

I hope this helps.

3 0
2 years ago
Evaluate 6 + x + 3y when x = 15 and y = 2
Anarel [89]

Answer:

the anwser is 27

Step-by-step explanation:

glad I could help!

7 0
3 years ago
X/5=1/(x+4) solve for x
solmaris [256]

ANSWER:

X is -5 and 1.

1) cross multiply

2) subtract five from both sides

3) factor

4) check for extraneous

5) ask me if you are still confused.

6 0
3 years ago
An empty suitcase has a mass of 2 kilograms. Draw a bar model to find its mass in grams.
miss Akunina [59]

Answer:

Since I can't draw it I'll give you the answer. 2,000 g.

Step-by-step explanation:

A kilogram is 1000 grams. Multiply 1000x2 to get 2000. But add the g for grams or the answer is considered wrong by teachers.

8 0
3 years ago
7)<br> 2 1<br> Please help giving Brainly
Mama L [17]

Answer:

You should use MathPapa.

Step-by-step explanation:

5 0
2 years ago
Other questions:
  • Seven more than three times a number is 166. Find the number
    7·1 answer
  • What number has to be added to each term of 3:5 to make the ratio 5:6?
    7·1 answer
  • Solve the equation 11x + 7 = 73?
    10·2 answers
  • On a no wind day, an airplane is flying 2000 miles round trip from Chicago to Boston and back to Chicago with a constant speed o
    10·1 answer
  • Find perimeter of a rectangle that is 21 ft by 3 ft
    7·2 answers
  • If one person takes six hours to paint a house in another person takes 10 hours to paint house how long does it take them to pai
    8·1 answer
  • A television is advertised for K2000 cash or on terms of 10% deposit and K80 per month for 3
    8·1 answer
  • Does this graph have a proportional relationship? Explain how you know.
    12·1 answer
  • If the temperature is –15.2 ºC what will the temperature be if decreased by <br> 1.5°C
    8·1 answer
  • Assume that you are going to open a checking account. You are examining different banks and banking accounts to choose a bank ac
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!