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]
4 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]4 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
Elijah invested $79,000 in an account paying an interest rate of 2% compounded
shusha [124]

Answer: He would have 16590 but if we want to know in total

it would be, 11060 (just from the percent) if you want to know in total add 16590 and 79,000 which would be (95,590 for Landon) and (Elijah would be 90060) in total

Step-by-step explanation:So in total Landon would have:

Landon-(95,590)

Elijah-(90,060)

So Landon would have 5,530 more dollars in 7 years than Elijah.

6 0
3 years ago
SOLVE
Neporo4naja [7]

Answer:

$26.40

Step-by-step explanation:

40% of 44 is 17.6.

44-17.6 = 26.40

4 0
3 years ago
WILL MARK!! pls help:) <br> Find x and y so that ABCD will be a parallelogram.
sladkih [1.3K]

Answer:

your answer will be B. 46

Step-by-step explanation:

hope it helps you...

have a great day!!!

8 0
3 years ago
Lucia is making invisibility potions. Each potion requires 2 eyes of newt. How many invisibility potions can Lucia make with 16
Oksana_A [137]
8.

16 eyes total / 2 eyes per potion = 8 potions
5 0
4 years ago
Read 2 more answers
A sweater was on sale at %40 off the regular price. Ella saved $20 by buying the sweater on sale. What was the regular price of
Artyom0805 [142]

so she saved $20 and that was 40% of the regular price, let's say the regular price is "x".

if 20 is 40%, what is "x" or namely the 100%?

\bf \begin{array}{ccll} amount0&\%\\ \cline{1-2} 20&40\\ x&100 \end{array}\implies \cfrac{20}{x}=\cfrac{40}{100}\implies \cfrac{20}{x}=\cfrac{2}{5}\implies 100=2x \\\\\\ \cfrac{100}{2}=x\implies 50=x

7 0
3 years ago
Read 2 more answers
Other questions:
  • Before going to school, Eudora ran from her home to a secret laboratory at an average speed of 12 km. Since she was running late
    7·1 answer
  • NEED HELP PLEASE!!!!!!!
    15·1 answer
  • Can someone help me plz!!!!!!!!!!!!!!!!
    6·1 answer
  • Sam makes about 79% of his free throws. he shoots 60 free throws. about how manywill he make?
    11·2 answers
  • A rectangular prism has a base length of 6 units, base width of 5 units, and height of 4 units. The bases are shaded.
    5·2 answers
  • Ramon and his brother go to an amusement park. They each go on the Ferris wheel that costs $6 per ticket and a roller coaster th
    7·2 answers
  • Un automóvil consume 4 galones de gasolina al recorrer 180 kilómetros y para recorrer 900 kilómetros necesita 20 galones ¿cuánto
    6·1 answer
  • If f(x)=2(x+2) ²-5, then calculate f(4)
    11·1 answer
  • How do I do number 2 and 4 please help
    13·2 answers
  • .Sammie paid $249.99 for a game system and then bought two equally-priced games. If she spent a total of $339.97, what is the pr
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!