Question: 2. In the program fragment shown on the next page, identify the following items: method heading, method body, method definition, formal parameters, actual parameters, method
2. In the program fragment shown on the next page, identify the following items: method heading, method body, method definition, formal parameters, actual parameters, method call, and local variables public class Exercise22 public static void main(String] args) int x double y char z; hello(x, y, z); hello(x + 2, y. - 3.5, 'S); public static void hello(int first, double second, Line 14 char ch) int num; double y a. Write the definition of method one so that it returns the sum of x and y ifx is greater than y; otherwise, it should return x minus 2 times y b Write the definition of method two as follows i. Read a number and store it in z. ii. Update the value of z by adding the value of a to its iii. Assign the variable first the value returned by method iii. Update the value of first by adding the value of x to V. If the value of z is more than twice the value of first, previous value one with the parameters 6 and 8 its previous value return z; otherwise, return 2 times first minus z
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
