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
A rectangle has sides measuring (2x + 7) units and (5x + 9) units. Part A: What is the expression that represents the area of th
andrey2020 [161]

Answer:

Part A:  

(2x+7)(5x+9)

=(2x+7)(5x+9)

=(2x)(5x)+(2x)(9)+(7)(5x)+(7)(9)

=10x2+18x+35x+63

=10x2+53x+63

A)

The formula for determining the area of a rectangle is given as

Area = length × width

Given that the length and width are (2x + 6) units and (5x + 3) units, the expression for the area is

(2x + 6)(5x + 3) = 10x² + 6x + 30x + 18

Area = 10x² + 36x + 18

B)

The degree is 2 because the highest power of the terms is 2. It is classified as a trinomial because it has 3 terms.

C) it is closed under multiplication. the exponents in the polynomials are whole numbers(2 and 1). The whole numbers are closed under addition, which means that the new exponents formed are also whole numbers. The exponents were whole numbers before multiplication and doesn't change after multiplication.

Step-by-step explanation:

3 0
3 years ago
I need help answering this question please help
MArishka [77]
40

Or at least that what my calculator says.
8 0
3 years ago
The ratio of boys and girls in the school musical is 5 to 8.Which of the following shows the possible numbers of boys and girls
Maurinko [17]

Answer:

I don't see the following ratios.

Step-by-step explanation:

I think you should add the following.

6 0
3 years ago
Read 2 more answers
Enter the trigonometric equation you would use to solve for x in the following right triangle. Do not solve the equation
Iteru [2.4K]
Angle x = arc tangent (7 / 24)
Angle x = arc tangent ( <span> <span> <span> 0.291666666...) </span> </span> </span>





6 0
3 years ago
Read 2 more answers
How do I ace a test that I am not prepared for?
Morgarella [4.7K]
You either start studying now or you fake it and guess and get lucky or you cheat

4 0
3 years ago
Other questions:
  • The side lengths of different triangles are given. Which triangle is a right triangle? A. 6,7,13 B. 21−−√,99−−√,11 C. 10,60,61 D
    6·1 answer
  • Four entrees are on next Friday’s menu: BBQ ribs, seafood platter, roast beef, and filet mignon. The number of each item sold th
    11·1 answer
  • The following data points represent the number of classes that each teacher at Broxin High School teaches.
    8·1 answer
  • Write these expressions in exponential form:
    6·1 answer
  • What interval consists of all $u$ such that neither $2u$ nor $-20u$ is in the interval $(-\infty,-1)$ ?
    10·1 answer
  • Fill in the blank 2(x+7) = 2x + __
    9·1 answer
  • Helen puts 50 marbles into 9 jars. First, she puts in the greatest
    8·1 answer
  • Read the question and answer. Ignore the c please, its incorrect.
    11·1 answer
  • Explain how to divide when the divisor is a decimal.
    12·2 answers
  • 3/10y - 2/5 i need to find the coefficient and i dont know how
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!