Create a flowchart for this Java program. public class QexamD { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner input = new Scanner(System.in); int largest = 0; int occurrence = 0; int number; // Prompt the user to enter number System.out.print("Enter number: "); do { number = input.nextInt(); if (number > largest) { occurrence = 0; largest = number; } if (number == largest) { occurrence++; } } while (number != 0); // Display to results System.out.println("The largest number is " + largest); System.out.println("The occurrence count of the largest number is " + occurrence); } } Note: Please don't use the automatic flowchart maker on the internet because it gives the wrong answer.
Create a flowchart for this Java
public class QexamD {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int largest = 0;
int occurrence = 0;
int number;
// Prompt the user to enter number
System.out.print("Enter number: ");
do {
number = input.nextInt();
if (number > largest) {
occurrence = 0;
largest = number;
}
if (number == largest) {
occurrence++;
}
} while (number != 0);
// Display to results
System.out.println("The largest number is " + largest);
System.out.println("The occurrence count of the largest number is " + occurrence);
}
}
Note: Please don't use the automatic flowchart maker on the internet because it gives the wrong answer.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images