The picture is as far as i've gotten Sample 1: Enter numbers: 3 5 2 5 5 5 0   -------> user enters each number one at a time. Hits enter after each number. Puts 0 when user wants to end. The largest number is 5 The occurrence count of the largest number is 4

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

The picture is as far as i've gotten

Sample 1:

Enter numbers: 3 5 2 5 5 5 0   -------> user enters each number one at a time. Hits enter after each number. Puts 0 when user wants to end.

The largest number is 5

The occurrence count of the largest number is 4

 

The finishing touch is the part in bold but i cant find a solution.

5.
9 import java.util.Scanner;
11 public class MaxValue {
public static void main(String[] args) {
13
int count =
14
int number = -1;
|-1;
15
int max = -1;
16
17
18
Scanner input = new Scanner(System. in);
System.out.print("Enter numbers :");
22
while (number !-0) {
number =
input.nextInt();
24
if (number > max) {
25.
26.
27.
28
number;
count = 1;
%3!
29.
30,
3.
34.
else if (number ==
count++;
} (xx
System.out.println("The largest number is:
System.out.println("The occurrence count of the largest number is "+count);
+max);
Console X3
Problems J Debug Shell
<terminated> MaxValue [Java Application] C:\Program Files\Java\jdk-11.0.12\bin\javaw.exe (Oct 23, 2021, 8:39:16 PM - 8:39:24 PM)
Enter numbers : 5 55 0
The largest number is: 5
The occurrence count of the largest number is 3
直。
55°F
12
144
prt sc
delete
80
Transcribed Image Text:5. 9 import java.util.Scanner; 11 public class MaxValue { public static void main(String[] args) { 13 int count = 14 int number = -1; |-1; 15 int max = -1; 16 17 18 Scanner input = new Scanner(System. in); System.out.print("Enter numbers :"); 22 while (number !-0) { number = input.nextInt(); 24 if (number > max) { 25. 26. 27. 28 number; count = 1; %3! 29. 30, 3. 34. else if (number == count++; } (xx System.out.println("The largest number is: System.out.println("The occurrence count of the largest number is "+count); +max); Console X3 Problems J Debug Shell <terminated> MaxValue [Java Application] C:\Program Files\Java\jdk-11.0.12\bin\javaw.exe (Oct 23, 2021, 8:39:16 PM - 8:39:24 PM) Enter numbers : 5 55 0 The largest number is: 5 The occurrence count of the largest number is 3 直。 55°F 12 144 prt sc delete 80
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education