Question: HistogramApp Now, you're going to work on a new class called HistogramApp ( in the HistogramApp.java file ) . You will use the Scanner class

HistogramApp
Now, you're going to work on a new class called HistogramApp (in the HistogramApp.java file). You will use the Scanner class to take user input to make your Histogram class more interactive.
In your main method:
Prompt the user to enter a lower bound and upper bound for their histogram.
Create a new instance of Histogram using this lower bound and upper bound.
Ask for user input until the program ends. Use a while loop to accomplish this. Implement the following commands (i.e. what should be done when the user types in this String):
"add": Prompt the user to enter a number to add to the Histogram. To do this, use a Scanner object to take in the user's input, and call the add() method on your Histogram instance.
"print": Give the user a view of their Histogram by printing it out. You can call System.out.println() on the Histogram instance, but your toString() method must work properly. You don't need to explicitly use the toString() System.out.println() will do it for you.
"quit" - Calling this should end your program.
ONLY take those three commands. If a user types something else in, remind them of their options. Here is a sample output:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!