Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java LO: (Apply) Students will use vectors to store data for a computation. The mode of a dataset is the item that appears most frequently.

Java

LO: (Apply) Students will use vectors to store data for a computation.

The mode of a dataset is the item that appears most frequently.

Write a program to read in numbers between 1 and 100 and then report the mode. If more than one number appears most frequently, choose the highest number. Output a line with the result in this format:

The most frequent value was 42, appearing 9 times.

CODE

public class DataAnalysis {

public static void main(String[] args) { // TODO: Write your code here System.out.println("The most frequent value was " + 50 + ", appearing " + 0 + " times."); }

}

Test Case

image text in transcribed

Test Case

image text in transcribed

Test Case

image text in transcribed

Test Case

image text in transcribed

DEBUG INFO Your instructor has chosen to give you the following information to help you debug your code and improve your submission. COMPILER STACK TRACE None PROGRAM EXECUTION STACK TRACE None INPUT OF THE TEST CASE 1 4 5 2 3 4 6 6 -1 5 YOUR CODE'S OUTPUT 1 2 The most frequent value was 50, appearing a times. THE CORRECT OUTPUT OF THE TEST CASE 1 The most frequent value was 6, appearing 2 times. 2 UNIX DIFF OF CORRECT OUTPUT AND YOUR OUTPUT 1c1 The most frequent value was 6, appearing 2 times. PRETTY DIFF This diff is colored to make it clear what parts of the output are wrong. Green indicates things in the correct output that you are missing, indicates things in your output that shouldn't be there. The character refers to newlines, so the green character refers a newline you are missing in your output and the red refers to a newline you need to remove from your output. 1 The most frequent value was 506, appearing 62 times. 2 DEBUG INFO Your instructor has chosen to give you the following information to help you debug your code and improve your submission. COMPILER STACK TRACE None PROGRAM EXECUTION STACK TRACE None INPUT OF THE TEST CASE 4 1 2 3 4 4 4 5 5 6 9 -1 8 YOUR CODES OUTPUT 1 2 The most frequent value was 50, appearing a times. THE CORRECT OUTPUT OF THE TEST CASE The most frequent value was 4, appearing 4 times. 1 2 UNIX DIFF OF CORRECT OUTPUT AND YOUR OUTPUT 1c1 The most frequent value was 4, appearing 4 times. PRETTY DIFF indicates This diff is colored to make it clear what parts of the output are wrong. Green indicates things in the correct output that you are missing, things in your output that shouldn't be there. The character refers to newlines, so the green character refers a newline you are missing in your output and the red refers to a newline you need to remove from your output. 1 The most frequent value was 504, appearing 24 times. 2 DEBUG INFO Your instructor has chosen to give you the following information to help you debug your code and improve your submission. COMPILER STACK TRACE None PROGRAM EXECUTION STACK TRACE None INPUT OF THE TEST CASE 1 2 2 3 3 3 4 4 5 4 6 4 8 -1 YOUR CODE'S OUTPUT 1 2 The most frequent value was 50, appearing a times. THE CORRECT OUTPUT OF THE TEST CASE 1 The most frequent value was 4, appearing 3 times. 2 UNIX DIFF OF CORRECT OUTPUT AND YOUR OUTPUT 1c1 The most frequent value was 4, appearing 3 times. PRETTY DIFF This diff is colored to make it clear what parts of the output are wrong. Green indicates things in the correct output that you are missing, indicates things in your output that shouldn't be there. The character refers to newlines, so the green character refers a newline you are missing in your output and the red refers to a newline you need to remove from your output. The most frequent value was 504, appearing 3 times. 2 1 DESCRIPTION Numbers DEBUG INFO Your instructor has chosen to give you the following information to help you debug your code and improve your submission. COMPILER STACK TRACE None PROGRAM EXECUTION STACK TRACE None INPUT OF THE TEST CASE 10 10 1 2 3 4 4 -10 YOUR CODES OUTPUT 1 2 The most frequent value was 50, appearing a times. THE CORRECT OUTPUT OF THE TEST CASE The most frequent value was 10, appearing 2 times. 1 2 UNIX DIFF OF CORRECT OUTPUT AND YOUR OUTPUT 1c1 The most frequent value was 10, appearing 2 times. PRETTY DIFF This diff is colored to make it clear what parts of the output are wrong. Green indicates things in the correct output that you are missing, indicates things in your output that shouldn't be there The character refers to newlines, so the green character refers a newline you are missing in your output and the red refers to a newline you need to remove from your output. 1 The most frequent value was 51e, appearing e2 times. 2

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

Database Technology And Management Computers And Information Processing Systems For Business

Authors: Robert C. Goldstein

1st Edition

0471887374, 978-0471887379

More Books

Students also viewed these Databases questions

Question

2 What are the implications for logistics strategy?

Answered: 1 week ago