Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134670942
Author: Y. Daniel Liang
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 21, Problem 21.6PE
Program Plan Intro

MaximumOccurence.Java

Program Plan:

  • Include the class name named “Count_Occurence”.
    • Declare the package.
    • Import the util package.
    • Define class.
    • Declare the main()method.
    • Create a Scanner.
    • Create a list and two sets.
    • Prompt the user to enter number of integers.
    • Declare an integer variable “key”.
    • Continue loop till entered value is 0.
      • Assign value to key as 1 if map does not contain key.
      • Calculate and assign frequency to key.
    • Find the maximum occurrence.
    • Display the integers that have the most occurrences.
    • Enter into the map and print the key with the maximum occurrence.
    • Close the main method.
    • Close the class.

Blurred answer
Students have asked these similar questions
(Python matplotlib or seaborn) CPU Usage We have the hourly average CPU usage for a worker's computer over the course of a week. Each row of data represents a day of the week starting with Monday. Each column of data is an hour in the day starting with 0 being midnight. Create a chart that shows the CPU usage over the week. You should be able to answer the following questions using the chart: When does the worker typically take lunch? Did the worker do work on the weekend? On which weekday did the worker start working on their computer at the latest hour?   cpu_usage = [ [2, 2, 4, 2, 4, 1, 1, 4, 4, 12, 22, 23, 45, 9, 33, 56, 23, 40, 21, 6, 6, 2, 2, 3], # Monday [1, 2, 3, 2, 3, 2, 3, 2, 7, 22, 45, 44, 33, 9, 23, 19, 33, 56, 12, 2, 3, 1, 2, 2], # Tuesday [2, 3, 1, 2, 4, 4, 2, 2, 1, 2, 5, 31, 54, 7, 6, 34, 68, 34, 49, 6, 6, 2, 2, 3], # Wednesday [1, 2, 3, 2, 4, 1, 2, 4, 1, 17, 24, 18, 41, 3, 44, 42, 12, 36, 41, 2, 2, 4, 2, 4], # Thursday [4, 1, 2, 2, 3, 2, 5, 1, 2, 12, 33, 27, 43, 8,…
Q5. (Find the second lowest interger number) Write a program that prompts the user to enter a set of integer numbers, and finally displays the second lowest integer number in the set. To exit from the program enter -1. Here is a sample run Enter a set of integer numbers: 3 57 928-1 The second lowest number is 3.
C++ ONLYTomorrow is the closing ceremony for the 2022 World Cup, and Cody and his friends want to know who the top scorer of the tournament is. John and the others insist that it Lionel Messi who is the top-scorer (scoring 10) but Cody, a Ronaldo fan, is stubborn and decided to make a list of all the players who scored goals and order them randomly. He then must look for the highest number and see if that number is higher than Messi’s goals.   Input the number of players then input the number of goals scored for each. Print "Not Messi" if the highest goals exceed 10 and "Okay, fine, it's Messi" if it doesn’t.Enter·the·number·of·players:·4 Goals·score·by·player·#1:·7 Goals·score·by·player·#2:·2 Goals·score·by·player·#3:·5 Goals·score·by·player·#4:·1 Okay,·fine,·it's·Messi
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning