Question: compile code to java Translate into Java the following pseudo-code, expressed in plain English. Goal: Write a method that returns true if an int value,
Translate into Java the following pseudo-code, expressed in plain English. Goal: Write a method that returns true if an int value, given as parameter, is close enough to either one of two pre-defined target values. The target values are 100 and 200. The method will return true if the parameter is within 10 (included) of either value. Variables declarations & initialization: Boolean variable named "result", initialized to false. Steps for the code: If the value in "n" is greater or equal to 90 Then: if the value in "n" is lesser or equal to 110 Then: set "result" to true. Else: if n is lesser or equal to 210 Then: if n is greater or equal to 190 Then: set "result" to true. Else: set "result" to false. Else: set "result" to false. Else: set result to false. Return the value contained in the variable "result". targetPractice(90) - true targetPractice(89) - false targetPractice(110) -- true Go ...Save, Compile, Run (ctrl-enter)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
