Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that outputs a histogram of grades for an assignment given to a class of students. The program should input each student's grade

image text in transcribed

Write a program that outputs a histogram of grades for an assignment given to a class of students. The program should input each student's grade as an integer and store the grade in a vector. Grades should be entered until the user enters "-1" for a grade. Use a map from an int to an int to compute the histogram. The first integer in the map represents the grade and the second integer represents the number of times that grade occurred. Output the histogram to the console. Break the histogram bins into values of 10, that is, grades between 0-10 are in bin 1 (call it "10"), grades between 11-20 are in bin 2 (call it "20"), grades between 21-30 are in bin 3 (call it "30"), etc until the highest bin for your grades. There should be no restrictions on the minimum and maximum grade for this programming project, that is, the bins are not stopping at "100", add as many as needed based on user input. A sample output (for input values up to 99 by the user) is shown below: The histogram for the grades entered is: 10: 0 20: 0 30: 2 40: 1 50: 4 60: 9 70: 16 80: 25 90: 8 100: 5

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

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions