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 can of juice is 6 inches high, and its base has a diameter
xenn [34]

Answer:

24 pie, or, 75.36 inches cubed

Step-by-step explanation:

The formula for volume of a cylinder is pie*radius^2*height

The radius is half the diameter, so the radius is 2 inches.

Plug in given information into the formula and solve.

4 0
3 years ago
If measure 5 = x, which angles have a measure of 180 - x? select all that apply
N76 [4]

Answer:

Step-by-step explanation:

175 is the answer I don’t feel like working it out

8 0
4 years ago
Steven wants to fill a 20gallon tank with water. If he uses2 1/2 gallon container to fill the tank, how many times must the cont
aliina [53]

Answer:8

Step-by-step explanation:

2 1/2 +2 1/2 + 2 1/2 + 2 1/2 + 2 1/2 + 2 1/2 + 2 1/2 + 2 1/2=20

5 0
3 years ago
Read 2 more answers
What is the sum?
Nezavi [6.7K]

Answer:

Its B on e2020

Step-by-step explanation:

correct on quiz

4 0
3 years ago
Read 2 more answers
Y = 15x + 10, where y is the total cost of renting 1 bicycle on the boardwalk for x hours. Determine whether the function is pro
vova2212 [387]

Answer:

The function is non-proportional.

Step-by-step explanation:

If the function was proportional, when the number of hours spent riding the bicycle is equal to 0, the total cost of renting the bicycle would also be 0. In other words, the function would be proportional if y=0 when x=0. However, this is not the case.

y=15x+10

Plug 0 into the equation as x

y=15(0)+10\\y=10

When 1 bicycle has been rented for 0 hours, the customer still has to pay 10 dollars just for renting it. When x=0, y=10. This means that the function is non-proportional.

I hope this helps!

4 0
3 years ago
Other questions:
  • The state of wyoming has roughly the shape of a rectangle that is 3.6 × 10 miles long and 2.8 × 10 miles high what is the aproxi
    11·1 answer
  • Trejon rides his bike 2 1/4 Miles each day. Which equation can be used to find r, the number of miles he will ride in 8 days?
    8·1 answer
  • Multiply both sides of the original equation by x, and find the solution set of the new equation.
    9·1 answer
  • Line q contains the points, (1, 5) and (1, 8). What is the relationship between the slope of line q and the slope of the x-axis?
    6·2 answers
  • Is the relationship between the values in the table a direct variation, an inverse variation, or neither
    11·1 answer
  • Can someone please help?<br><br> Write the equation of the inequality.
    14·1 answer
  • Which of the following is equivalent to the expression (9x^2y^3)(12x^-3y^5)(2xy)?
    13·2 answers
  • The equation h(t) = -16t^2? + 32t + 128 models the path of a ball thrown in the air from the top of a building. After how many s
    8·1 answer
  • Santiago is trying to earn experience points in his newest game. He knows that finding
    11·1 answer
  • Assume that the college in Offer #1 has a Cost of Attendance of $73,332. Which of the statements below comparing Offer #1 to Off
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!