Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Histogram Maker Now that we are done with your first exam, I need to develop a histogram based on your grades, so I can get

Histogram Maker

Now that we are done with your first exam, I need to develop a histogram based on your grades, so I can get a better sense of how you did. I have two ways of doing it. Learn how to do it myself and do it, or ask you to write a program that does it for me. I choose the latter!

Please write a program that keeps reading your grades (integers between 0 and 100) until it gets to a -1. (Assume the user enters all scores in one line, and get them using the .next() method)

  • Then, produces a histogram, based on the number of scores in each bin.
  • Consider one bin for all the lower than 60 scores, one for 60 to 69, then 70 to 79, 80 to 89, 90 to 99, and finally, one bin for those who got 100.
  • Then print the histogram using Xs, following the below format:
    • For examples, if the scores are 100 94 65 52 84 86 85 94 92 88 84 79 80 81 72 99 98 99 100 100 -1
    • The histogram should be:
[ <=59]:X [60-69]:X [70-79]:XX [80-89]:XXXXXXX [90-99]:XXXXXX [==100]:XXX

import java.util.Scanner;

public class Main { public static void main(String[] args) { Scanner scnr = new Scanner(System.in);

/* Type your code here. */ } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions