Display a list of distinct numbers in the input

Assignment Help Computer Engineering
Reference no: EM132200857

Question :

Write a Java program called Histogram.java that reads integer values from a user. Your program should display a list of distinct numbers in the input and the occurrence of each distinct value.

After that, your program should draw a vertical bar for the occurrences. In the program, you can assume that the number of input values from a user is less than or equal to 30. Additionally, you can assume that the input number itself is between 0 and 9.

A sample run of your program should be like below:

How many input values [max: 30]?
5
Enter 5 numbers.
2
1
2
0
2
Number Occurrence
0 1
1 1
2 3
========= Vertical Bar ========
| 3 | -------- *
| 2 | ---------*
| 1 | -----* * *
===============================
| No | 0 1 2 3 4 5 6 7 8 9
===============================

The vertical bar will be a representation of the histogram and how many occurences. without the dashes(ex. ---) on the vertical scale.

Reference no: EM132200857

Questions Cloud

Prompt the user to enter a regular expression : Write a Java program that prints all strings defined by a regular expression up to a given length.
Write a program that reads ten characters into a linked list : Write a java program that reads ten characters into a linked list and displays them in the reverse of the order in which they were read.
Write a java program with two checkboxes : Write a Java program with two checkboxes, one labeled BLUE and the other labeled ORANGE.
Reverse the order of words and displays on the console : Write a Java program that reads a file, reverses the order of words and displays on the console. The words can be on the same or separate lines.
Display a list of distinct numbers in the input : Display a list of distinct numbers in the input and the occurrence of each distinct value.
Demonstrate that the algorithm works using two threads : Use threads to implement Peterson's algorithm for mutual exclusion. Demonstrate that the algorithm works using two threads.
Write a java program that creates a one-dimensional array : Write a JAVA Program that creates a one-dimensional array and fills it with the following numbers in this given order.
What role do portals play in : Are they still as relevant as they were a few years ago? More relevant? Support your conclusion with additional research on the web.
A program to calculate rectangular and right triangles : Write a java program that calculates of rectangular and right triangles. The main function then only outputs the areas of the two calculated areas.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Create a data type using a doubly-linked circular structure

In this lab, using C++, you will create an abstract data type, using a doubly-linked circular structure to store the values and links.

  Devise 7-bit even-parity hamming code for the digits 0 to 9

Devise a 7-bit even-parity Hamming code for the digits 0 to 9.

  Write a program that takes a filename as argument

Write a program that takes a filename as argument, checks whether the file exists, and prints binary if the file is binary.

  Describe at least three different classes that the program

Describe at least three different classes that the program may contain.

  Why td updates are likely to be much better

Can you see why TD updates are likely to be much better, at least initially, in this case? Might the same sort of thing happen in the original task?

  Describe access control and its level of importance

It is an accepted truth that without risk there can be no gain. Every individual and organization who wants to succeed must take some risks.

  What is the necessary memory cycle time

In a time slot interchange (TSI) switch, 8 input lines are scanned in sequence to build up an input frame with 8 slots. The incoming lines each produce 16KBps (B=Byte). Each slot in the TSI switch holds 8 bits. What is the necessary memory cycle t..

  Use the web to research and evaluate security products from

in a two-page apa formatted paper provide analysis answering the followinguse the web to research and evaluate security

  Analyze the methods for establishing key risk indicators

Analyze the methods for establishing key risk indicators (KRIs). Summarize the COSO Risk Management Framework and COSO's ERM process.

  What should the given objectives be

You are a member of the Human Resources Department of a medium-sized organization that is implementing a new interorganizational system.

  Write a to-string function for file linked-stack-tc

Write a to_string function for file Linked_Stack.tc. Write a copy constructor and assignment operator for file Linked_Stack.tc.

  What modifications are needed in the functions merge-sort

Implement the following modification that will save some of this time. What modifications are needed in the functions merge_sort( ) and recursive_merge_sort( )?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd