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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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 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:

  1. Declare a sum, a count and a double-precision array as a data members of your C++ class.

For each incoming number:

  1. Get the input value from either the supporting non-class code or from your own code within the class itself.
  2. Add the incoming numbers to a sum.
  3. Count the incoming numbers.
  4. Enter each number into an array.

For the final calculations:

  1. Report on the user’s display screen the sum and count of numbers entered.
  2. Calculate and report the average of the numbers.
  3. 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.
  4. Find or calculate the value of the median and report it.

Then, the program should terminate its execution normally.

Here is my code

#include
using namespace std;
int main()
{
// creating double precision variables to store the numbers
double sum = 0.0;
int count = 0;
double arr[50];
// flag to check if user entered eof
bool flag:
// taking numbers from user
do
{
//storing the the number in double
double temp;
Transcribed Image Text:#include using namespace std; int main() { // creating double precision variables to store the numbers double sum = 0.0; int count = 0; double arr[50]; // flag to check if user entered eof bool flag: // taking numbers from user do { //storing the the number in double double temp;
Expert Solution
steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
Concept of pointer parameter
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education