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
Im so confused please help with 5 and 6
Drupady [299]

Answer:

5)102,78

6)56,56

<em><u>See</u></em><em><u> </u></em><em><u>THE</u></em><em><u> </u></em><em><u>IMAGE</u></em><em><u> </u></em><em><u>FOR</u></em><em><u> </u></em><em><u>SOLUTION</u></em><em><u> </u></em>

8 0
3 years ago
Read 2 more answers
In an August 2012 Gallup survey of 1,012 randomly selected U.S. adults (age 18 and over), 536 said that they were dissatisfied w
soldier1979 [14.2K]

Answer:

Yes, result is significant ; PVALUE < α

Step-by-step explanation:

Given :

x = 536

n = sample size = 1012

Phat = x / n = 536 / 1012 = 0.5296 = 0.53

H0 : P0 = 0.5

H1 : P0 > 0.5

Test statistic :

(Phat - P0) ÷ sqrt[(P0(1 - P0)) / n]

1-P0 = 1 - 0.5 = 0.5

(0.53 - 0.5) ÷ sqrt[(0.5*0.5)/1012]

0.03 ÷ 0.0157173

= 1.9087

Pvalue :

Using the Pvalue from test statistic :

Pvalue = 0.02815

To test if result is significant :

α = 0.05

0.02815 < 0.05

Pvalue < α ; Hence, result is significant at α=0.05; Hence, we reject H0.

3 0
3 years ago
2 6
Irina18 [472]
I think it is -2288 something like that

3 0
3 years ago
10. Solve the inequalities and compare.<br> a. Solve 2x+6 &lt; 10.
natali 33 [55]

Answer:

not possible, bother terms have to contain a letter variable

4 0
3 years ago
From 1000, create a pattern by subtracting 8 from each number and stop at 5 numbers
shusha [124]
Well subtract 8 from 1000 and then do that five times. so 992,984,976,968, and 960<span />
7 0
3 years ago
Other questions:
  • Allison has 5 times as many baseball cards as football cards. In all she has 120 baseball and football cards. How many baseball
    14·1 answer
  • Given a polynomial and one of its factors bother main factors 9x^3 + 20x^2 - 68x - 16; (x+4)
    15·1 answer
  • In september, seattle's daily high temperature has a mean of 70 °f and a standard deviation of 7 °f. What are the mean, standard
    15·1 answer
  • What integer is equivalent to 9 3/2
    7·2 answers
  • Help please need answer asap<br><br><br><br><br><br><br><br> slope = 3
    7·1 answer
  • What is (x + 5)power of 8 (x + 5) power of -6
    10·1 answer
  • Last year 12 records in his collection now he has 15 records what is his percent increase of his Collection
    6·1 answer
  • PLZZ HELPP IM FAILLING THIS CLASS
    13·1 answer
  • Mark went to the sandwich shop. He had a choice of 2 types of bread, 3 meats, and 3 drinks. How many different combinations did
    9·2 answers
  • Solve 7z^2 + 4z - 1) + (2z^2 - 6z + 2)
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!