subject

In the linked-list based bag implementation, we demonstrated the functionalities, such as, add, remove, and list. Extend the functionalities of the bag with other operations average, min, and max, You need to extend the Bag class (under Wk 2, BagLinked_List. cpp) with the following methods: -int Bag::min( ), is to find minimum of items of the bag.

-int Bag::max( ), is to find maximum of items of the bag

-float Bag::ave( ), is to find average of the items of the bag.

After expanding the Bag class with these functions, demonstrate their functionalities with a similar to:
Create a bag A with the items 8, 4, 5, 6, 1, 3; and create another bag, B, with the items 4, 6, 9, 2.

Then show that:

cout << A. min() << ", " << A. max() << ", " << A. ave () ;
cout << B. min() << ", " << B. max() << ", " << B. ave () ;

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 19:20, SundaeSunday
Consider the following code snippet: #ifndef cashregister_h#define cashregister_hconst double max_balance = 6000000.0; class cashregister{public: cashregister(); cashregister(double new_balance); void set_balance(double new_balance); double get_balance() const; private: double balance[12]; }; double get_monthly_balance(cashregister bk, int month); #endifwhich of the following is correct? a)the header file is correct as given. b)the definition of max_balance should be removed since header files should not contain constants. c)the definition of cashregister should be removed since header files should not contain class definitions. d)the body of the get_monthly_balance function should be added to the header file.
Answers: 1
image
Computers and Technology, 22.06.2019 20:00, bowmanari2154
What is used to analyze and summarize your data without graphical support
Answers: 1
image
Computers and Technology, 22.06.2019 22:30, jacob7542
The qwerty keyboard is the most common layout of keys on a keyboard
Answers: 3
image
Computers and Technology, 23.06.2019 21:50, Trinhphuongtran
Description: write function lastfirst() that takes one argument—a list of strings of the format "lastname, firstname" —and returns a list consisting of two lists: (a) a list of all the last names (b) a list of all the first names
Answers: 2
You know the right answer?
In the linked-list based bag implementation, we demonstrated the functionalities, such as, add, remo...

Questions in other subjects: