Question: Define a method computeVal ( ) that has one integer parameter and returns the parameter minus 6 if the parameter is greater than 8 .

Define a method computeVal
(
)
that has one integer parameter and returns the parameter minus
6
if the parameter is greater than
8
.
Otherwise, computeVal
(
)
returns the parameter plus
6
.
import java.util.Scanner;
public class ValueComputation
{
/
*
Your code goes here
*
/
public static void main
(
String
[
]
args
)
{
Scanner scnr
=
new Scanner
(
System
.
in
)
;
int inNum;
int result;
inNum
=
scnr
.
nextInt
(
)
;
result
=
computeVal
(
inNum
)
;
System.out.println
(
result
)
;
} java
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!