Starting from:

$29.99

csc3002 Problem 1 [2 pts] Solution

Exercise 11.6:
Using the following definitions of MAX JUDGES and scores as a starting point.
const int MAX JUDGES = 100; double scores[MAX JUDGES];
Write a program that reads in gymnastics scores between 0 and 10 from a set of judges and then computes the average of the scores after eliminating both the highest and lowest scores from consideration. Your program should accept input values until the maximum number of judges is reached or the user enters a blank line. A sample run of this program might look like this:

Requirments:
Please finish sumArray, findLargest and findSmallest functions in the file GymnasticsJudge.cpp according to the file GymnasticsJudge.h.
Problem 2 [3 pts]
(a) Exercise 12.4:
Design and implement a class called IntArray that implements the following methods:
• A constructor IntArray(n) that creates an IntArray object with n elements, each of which is initialized to 0.
• A destructor that frees any heap storage allocated by the IntArray.
• A method size() that returns the number of elements in the IntArray.
• A method get(k) that returns the element at position k. If k is outside the vector bounds, get should call error with an appropriate message.
• A method put(k, value) that assigns value to the element at position k. As with get, the put method should call error if k is out of bounds.
Requirments:
Please finish constructor, destructor, size, get and put functions in the file intarray.cpp according to the file intarray.h.
(b) Exercise 12.5:
You can make the IntArray class from the preceding exercise look a little more like traditional arrays by overriding the bracket-selection operator, which has the following prototype:
int & operator[](int k);
Like the get and put methods, your implementation of operator[] should check to make sure that the index k is valid. If it is, the operator[] method should return the element by reference so that clients can assign a new value to a selection expression.
Requirments:
Please finish operator[] function in the file intarray.cpp according to the file intarray.h
(c) Exercise 12.6:
Implement deep copying for the IntArray class from Problem 2(a) and (b).
Requirments:
Please finish copy constructor and assignment operator in the file intarray.cpp according to the file intarray.h
Requirements for Assignment
We have provided a project named as AS3 ID.pro. Firstly, please replace the ID with your student ID in both .pro file and the project folder name. (e.g. if your student ID is 123456, hereby the file should be named as AS3 123456),
You should finish all .cpp files except the Assignment3.cpp according to the problem requirements. You are not allowed to modify any .h files. Finally, pack your whole project files into a single .zip file, and submit the .zip file via BB system.
Reminder: Please switch your input language to English before interacting in Stanford console.
Or, you will get no response.

More products