Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

7.19 zyLab: Find Max 3. public void findMax0 - Prompt the user to repeatedly ent

ID: 3909529 • Letter: 7

Question

7.19 zyLab: Find Max 3. public void findMax0 - Prompt the user to repeatedly enter an integer. This continues until the user enters a negative number. Along the way, keep track of the largest number that has been entered so far. Print the largest number. For example,299 17 4-1 will print 99 LAB ACTIVITY 7.19.1: zyLab: Find Max Main.java Load default template... 1 public class Main f public void findMaxOL 4 Type your code here. 7 public static void main(String args) Main test new Main; test.findMax) 10 12 13

Explanation / Answer

public void findMax() { Scanner in = new Scanner(System.in); int max = Integer.MIN_VALUE; int num; while (true) { num = in.nextInt(); if(num < 0) break; if(num > max) { max = num; } } System.out.println(max); }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote