Write C++ program for the following problem. Ensure that your program compiles and runs correctly. Upload the .cpp files. Name your files exactly as your instructor has specified. Use pointer notation. Programming Project on Chapter 13 Introduction to Classes Student.h and Student.cpp Write a class named Student. The Student class should have the following members variable: Member Name Data Type Description Name string Student name IdNum string Student ID number NumTests lint number of tests a student has written Tests pointer to double Pointer to an array of test scores Average double Average test score Grade char Course grade
. The Student class (at least) should have the following member methods: Member Functions DataType Purpose Default Constructor assigns empty name and id to empty strings. Assigns numTests to O, makes the test pointer point to nullptr, assigns 0 to average and empty char to the letterGrade. Overloaded Constructor(s) assigns the member attributes with the values passed as arguments. The overloaded constructor is responsible for allocating memory for the test pointer. You should have at least one overloaded constructor; you can create as many overloaded constructors as you need. Destructor deletes the memory allocated by the constructor of the object. Setter/Mutator Methods void one setter/mutator methods for each attribute. For the setter method for the tests array, use good design practices. You can use one method with as many arguments as the number of tests or any other way you see fit. Note: There should be no setter method for average and grade, since this can lead to stale data. Getter/Accessor Methods one getter/accessor function that returns the value of each dependent on attribute. I would leave the getter methods for the tests array to the data type your design choice. You can return a pointer to the start of the of the array or you can return a test score and call the method in a attribute loop - your choice. Note: There should be no getter method for average and grade, since this can lead to stale data.
a private double calcAverage method calculates and returns the average which should then be assigned to average member. a private calcGrade method char calculates and returns the grade which should then be assigned to grade member. Your class specification must be saved in Student.h and the function definitions need to be saved in Student.cpp. 1. Student Grade Program: student Program.cpp - 20 pts The program should ask the user how many students' test scores it is going to keep track. Make sure that the user enters positive numbers for the number of students. Your program should then dynamically allocate an array of objects. Each object's Tests member should be allocated dynamically based on how many tests the student took and should point to the array that will hold the test scores. After the arrays have been dynamically allocated, the program should ask the user to enter each student's information. Do not accept negative numbers for any test score. It should calculate the average test score and the course grade should be computed on the basis of the following grading scale: Average Test Score Grade >= 90 A >= 80 and < 90 B >= 70 and < 80 с >= 60 and < 70 < 60 F
Note: There are no member attributes to store the [Extra Credit 10 pts] Once all this data is calculated, sort the array based on the student id. You can use any of the sorting algorithms covered in Ch 08 (example code can be found in Ch 08 Knowledge Building page). Display the sorted array listing each student's name, ID number, average test score, and course grade. Be careful when dealing with the tests array as it is a pointer element.
Write C++ program for the following problem. Ensure that your program compiles and runs correctly. Upload the .cpp files
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Write C++ program for the following problem. Ensure that your program compiles and runs correctly. Upload the .cpp files
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!