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
Please help!<br><br> Add using a number line<br><br> −2/5 +4/5 = ?
kobusy [5.1K]

-  \frac{2}{5}  +  \frac{4}{5}  =  \frac{2}{5}
5 0
3 years ago
What is the volume of the rectangular prism?
Mashcka [7]

Answer:

96 cubic inches

Step-by-step explanation:

8x3=24=area x4 = 96 = volume

5 0
2 years ago
Kayla owns a food truck that sells tacos and burritos. She sells each taco for $3 and each burrito for $7.25. Yesterday Kayla ma
Trava [24]
Let t = the number of tacos sold
Let b = the number of burritos sold
3t + 7.25b = 595
B=2t
4 0
3 years ago
I dont get how to do this problem
gladu [14]
1/4 I believe assuming you hit any where inside (as it says) you count each chance you have (each color) and then simply just know that there’s only 1 color you can score points on its 1/3
4 0
3 years ago
Simplify 4(12 + 6) using distributive property
Doss [256]

Answer:

72

Step-by-step explanation:

7 0
3 years ago
Read 2 more answers
Other questions:
  • What is the number six million, thirty thousand, expressed in scientific notation?
    11·1 answer
  • Justin deposited $54.25 into his bank account after making a $30.00 withdrawl to pay for some school supplies. Represent these s
    7·1 answer
  • If the area of a square is numerically twice the perimeter of that square, what is the side of the square?
    6·1 answer
  • Buck has 45 cookies. He wants to pack an equal number of cookies into different bags. In how many ways can he pack the cookies i
    12·2 answers
  • What are the zeros of the function f(x) = (3x^2 + 9x + 6) / (3x - 6) ?
    12·1 answer
  • The Tom Joyner Morning Show is a nationally syndicated African American talk show with millions of listeners in many cities
    13·1 answer
  • A scout troop is planting trees at the state park. The troop planted 7 trees in 3 hours. At that rate, how many trees will they
    15·1 answer
  • Divide 80 into two parts such that greater part is 4 times the smaller.
    8·1 answer
  • The vertices of a rectangle are listed below.
    7·1 answer
  • Please halp me in the question?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!