Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the following class called Section that stores the final grades of all the students enrolled in a specific section of a class. class Section
Consider the following class called Section that stores the final grades of all the students enrolled in a specific section of a class. class Section { public: Section() { // constructor nST = 0: } void addGrade(float grade) { ST [nST] = grade: nST++: } private: float ST[26]: int nST: // number of final grades stored }: a) The ST member variable can store at most 26 students. Change the code so that ST can store as many final grades as needed when a Section object is created. Change/add constructor and destructors as needed. b) Add a copy constructor for the above case. Imagine that you and your friend have been asked to write a C++ program to list all the 10 U.S. federal holidays in increasing calendaristicorder. (Rules on deciding these holidays are presented here: You decide to split the task as follows: - Your friend will write the code for a Holiday class - You will write the main function that will use the Holiday class Your friend provides you the following header file containing only the class declaration: class Holiday { public: Holiday (string holidayDate): // initialize with the giver, holiday's // date in the calendar int getDay(): // return the day of the holiday Int getMonth (): // return the month (1-12) of the holiday a) Is this header file sufficient for you to write your main function code? Or do you also need to see the Holiday class' source file with the class definition? b) Is this header file sufficient for you to compile your program? Or do you also need the Holiday class' source file with the class definition? The following part of a program computes and returns the product 1 * 2 * 3 * * N where N is the input parameter. (This value is called N! And is much used in combinatorics.) However, this function can give unexpected answers for some inputs of N! Add exception handling to this function to catch this situation. You should include both catch and try blocks. Your exception can be of any type, preferably std:: exception. int productOfNumbers (int N) { int p = 1: while (N ! = 0) { // count down until zero p *= N: N--: } return p: } int main () { int n: cout > n: cout
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started