Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

implement a method called maxFive that returns an integer that is the maximum value among the five parameters. Ex: maxFive(3, 5, 1, 0, 2)

 image

implement a method called maxFive that returns an integer that is the maximum value among the five parameters. Ex: maxFive(3, 5, 1, 0, 2) returns 5. /** * This method returns the maximum number among the five parameters. * * @param numl an integer * @param num2 an integer * @param num3 an integer * @param num4 an integer * @param num5 an integer * @return an integer that is the maximum among the parameters * */ public static int maxFive (int numl, int num2, int num3, int num4, int num5) { } Hints: Use four if statements. (Don't use if-else). Use a variable maxFound to keep track of the largest value seen so far. Initialize maxFound to one of the parameters. (Not to 0, which wouldn't handle the case when all parameters are negative). Don't forget to return maxFound. Revised by Rita Tong. Reviewed by Carter 379342.2486054.qx3zay? 25 26 27 28 29 30 31 32 33 34 35 36 37 public static void main(String[] args) { 38 39 40 } // Don't modify main's code below Scanner scnr = new Scanner(System.in); int v, w, x, y, z; int maxVal; V = scnr.nextInt(); W = scnr.nextInt(); x = scnr.nextInt(); y = scnr.nextInt(); Z = scnr.nextInt(); = maxVal maxFive (v, w, x, y, z); System.out.println(maxVal); Max.java Load default template...

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to graph theory

Authors: Douglas B. West

2nd edition

131437372, 978-0131437371

More Books

Students also viewed these Programming questions

Question

Verify that B = curl(A) for r > R in the setting of Example 6?

Answered: 1 week ago