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 spinner has three sections. The table shows the results of spinning the arrow on the spinner 80 times.
slega [8]

Answer:

9/20

Step-by-step explanation:

Total trials = 80

Observed successful trials = 36

36/80

= 9/20

3 0
4 years ago
PT= 4x+6 and TQ=9x-9 find the values of x and PT . Please help me I’m stuck
Sever21 [200]
X=3
PT=18

Steps:
4x+6=9x-9
Add 9 to 6 and subtract 4x from 9x
15=5x
3=x
Plug 3 into equation
12+6=18
8 0
3 years ago
Find the EQUATION of the line through (-10,-12) and (-15,3). Use the form y=mx+b.​
vovikov84 [41]
Y=Mx+b

Y=-3x-42

Please mark brainliest. Thank you
8 0
2 years ago
- The wait times for two different rides are
erma4kov [3.2K]

Answer:

(in a fraction format) 12/75=x/120

Step-by-step explanation:

The simplest way I can explain* is for these types of problems, all you do is make an equation like the one above and use an X as the numerator in the second equation over the denominator, which should be something like 120 in this problem. So after you find the information for the problem, which is the part where it states how much time a line of 48 people had to wait, make an equation using that information, which is 12/48. Then to finish the equation, use the 120 people in line part and make another equation that has an X as the numerator, or the number on top. It should look like this:

           12/75 = x/120

I tried sorry*

8 0
3 years ago
What must be the value of x for a to be parallel to b? m∠1 = 98 and m∠2 = 9x+17
Umnica [9.8K]

I think it is C .....

4 0
3 years ago
Other questions:
  • Suzanna wants to measure a board, but she doesn’t have a ruler to measure with. However, she does have several copies of a book
    5·2 answers
  • Please help immediately
    5·1 answer
  • A scale drawing has a scale of 0.25 in. : 12 ft. Find the length on the drawing for an actual length of 15 ft.
    6·2 answers
  • When should fixed and variable monthly budgeted expenses first be planned?
    8·1 answer
  • 100 POINTS AND BRAINLIEST! SUPPER EASY IM JUST DU.MB!
    5·2 answers
  • Please help me out here I would really appreciate it (will give brainiest if right)
    5·1 answer
  • Rihanna colored ones Brianna color 1/6 of her picture and somebody colored 1/4 of his picture who played more
    7·1 answer
  • Pls explain the answer.
    12·1 answer
  • What slope of this line <br> x 9 13 17 21<br> y -24 -21 -18 -15
    13·1 answer
  • A youth group takes a bus to the movie theater. The cost of a drink is $2.25, the cost of popcorn is $3.45, and the cost of a ti
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!