Solution: Methods
Let's discuss the solution to the exercise.
We'll cover the following
Problem
This exercise creates a method to determine if a number is positive or negative. Create a console-based application for a PositiveOrNegative
app that meets the requirements below:
- Write a method that receives an
integer
as an argument. - The method should determine if a number is positive or negative.
- Display a message with the number and whether it’s
positive
,negative
, orneither positive nor negative
(zero).
Get hands-on with 1400+ tech skills courses.