C++ CODE DEBUG FIXING A rise will be given after giving me an explanation and output screen cut HERE IS DEBUG NOTE Dear Andy, I have withheld an assignment of a grade for two major reasons. The first is that the program does not demonstrate a knowledge of the usage of C++ class. The second is that the use of the compile-time library leads to some usages which are not standard C++ and which caused your program to fail to compile using my standard C++ compiler. I will explain these issues below. First, the usage of class has two data members specified as public. This is incorrect usage, because all data members in a C++ class must be specified as private. Therefore, access to them in the using program must use get and put methods. For example getSum and putSum, also getCount and putCount. These methods should appear under public. These methods and additional methods are the only way to access the data members of a class. In addition, your program has redefined sum and count as variables in the main of your program. The result is that the C++ compiler does not use the definitions of the data members sum and count in your class. In order to do this access, the program in tts main procedure must declare an object which accesses a data member of the class for either update or retrieval. Your program does not do any of these three things. Accordingly, the program is not using Object-orainr C++. Please read through my Appendix A to see examples of introductory programs which use Object-oriented C++. Second, the library stdc++.h is not a standard compile-time C++ library. I searched for it online and found a reference to it in the web site Geeks for Geeks. The library was written to support the GNU operating system which was developed by the Free Software Movement in the 1989's. It has remained in the public domain ever since. However, it has not been accepted by the official committee which standardizes the C++ language. Therefore, a statement such as your line 65 double finalArr[count]; failed to compile and produced the diagnostic message "error C2131: expression did not evaluate to a constant". This means that standard C++ only allows fixed-length arrays to be defined at compile time. However the definition double finalArray[count] intends to define the size of an array at run time. which is not allowed in standard C++. We need to discuss these issues when we return from Spring Break vacation. However, I commend your use of the cin methods eof() , fai(), clear() and ignore(). Best wishes. JM HERE IS REQUIREMENT I need a C++ program which allows me to enter a series of not more than 50 student grades, which are to be processed as double precision numbers, and which will calculate the average grade and the median grade for those grades which were entered. Point of information, the median grade of a list of grades is either the middle grade if the number of grades entered is odd. Or, if the count of grades entered is even, the median grade is the average of the two grades in the middle. Your program must use C++ Input and Output to interact with the user. If the user wishes to enter less than 50 grades, the user must hit the EOF command on the keyboard. But, if the user has entered 50 entries, the program will move to the next task automatically, after giving the user an informative message saying that no further input is allowed for the run. Your program will contain and use a C++ class to do the following operations: Initially: Declare a sum, a count and a double-precision array as a data members of your C++ class. For each incoming number: Get the input value from either the supporting non-class code or from your own code within the class itself. Add the incoming numbers to a sum. Count the incoming numbers. Enter each number into an
C++ CODE DEBUG FIXING
A rise will be given after giving me an explanation and output screen cut
HERE IS DEBUG NOTE
Dear Andy,
I have withheld an assignment of a grade for two major reasons. The first is that the program does not demonstrate a knowledge of the usage of C++ class. The second is that the use of the compile-time library leads to some usages which are not standard C++ and which caused your program to fail to compile using my standard C++ compiler. I will explain these issues below.
First, the usage of class has two data members specified as public. This is incorrect usage, because all data members in a C++ class must be specified as private. Therefore, access to them in the using program must use get and put methods. For example getSum and putSum, also getCount and putCount. These methods should appear under public. These methods and additional methods are the only way to access the data members of a class. In addition, your program has redefined sum and count as variables in the main of your program. The result is that the C++ compiler does not use the definitions of the data members sum and count in your class. In order to do this access, the program in tts main procedure must declare an object which accesses a data member of the class for either update or retrieval. Your program does not do any of these three things. Accordingly, the program is not using Object-orainr C++. Please read through my Appendix A to see examples of introductory programs which use Object-oriented C++.
Second, the library stdc++.h is not a standard compile-time C++ library. I searched for it online and found a reference to it in the web site Geeks for Geeks. The <bits/stdc++.h> library was written to support the GNU
We need to discuss these issues when we return from Spring Break vacation.
However, I commend your use of the cin methods eof() , fai(), clear() and ignore().
Best wishes.
JM
HERE IS REQUIREMENT
I need a C++ program which allows me to enter a series of not more than 50 student grades, which are to be processed as double precision numbers, and which will calculate the average grade and the median grade for those grades which were entered. Point of information, the median grade of a list of grades is either the middle grade if the number of grades entered is odd. Or, if the count of grades entered is even, the median grade is the average of the two grades in the middle.
Your program must use C++ Input and Output to interact with the user. If the user wishes to enter less than 50 grades, the user must hit the EOF command on the keyboard. But, if the user has entered 50 entries, the program will move to the next task automatically, after giving the user an informative message saying that no further input is allowed for the run.
Your program will contain and use a C++ class to do the following operations:
Initially:
- Declare a sum, a count and a double-precision array as a data members of your C++ class.
For each incoming number:
- Get the input value from either the supporting non-class code or from your own code within the class itself.
- Add the incoming numbers to a sum.
- Count the incoming numbers.
- Enter each number into an array.
For the final calculations:
- Report on the user’s display screen the sum and count of numbers entered.
- Calculate and report the average of the numbers.
- Sort the array in ascending order. You can use Bubble sort internally or use the sort in the
algorithms STL (Standard Template Library) in your class code. - Find or calculate the value of the median and report it.
Then, the program should terminate its execution normally.
Here is my code
Step by step
Solved in 4 steps with 5 images