Question: C++ help no maps just use an array in the class Lab 1: Arrays and Classes 1. Consider a situation, such as a lottery, where

C++ help no maps just use an array in the class

C++ help no maps just use an array in the class Lab

Lab 1: Arrays and Classes 1. Consider a situation, such as a lottery, where over time certain numbers appear. Wayne wants to know how often each number appears. In C++, create a class Number Count to count the occurrences of numbers. The class should use an array for storage. The methods that the class should have are: Unique constructor takes two arguments: the minimum and maximum num- ber that can occur. void addElement(int number): increment the count of number bool removeElement(int number): decrement the count of number void display(): draw the results as a histogram 2. Also create a main function in TestNumberCount.cpp that properly exercises your class. For example: NumberCount N(11,16); N.addElement(12); N.addElement(12); N.addElement(12); N.addElement(14); N.addElement(17); N.addElement(13); N.removeElement(11); N.removeElement(13); N.display(); produces: 17 Out of range; 11 not present; 11: 12:*** 13: 14:* 15: 16: Submit via handin. Note that in C++, an array can be dynamically allocated using the new command. For example: int *A = new int[MAX-MIN+1]; Your code should work on our system compiled with g++ -Wall -std=c++11 NumberCount.cpp TestNumberCount.cpp

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 Databases Questions!