subject
Engineering, 15.02.2020 01:52 msalecora

C++ Programming

Create a class template Pair that houses 2 items of datatype T.
Whatever datatype stored needs to implement the < and > operators.
There should be two private data attributes called item1 and item2.
There should be the following public methods.

A 2 argument constructor.
A method getMax that returns the larger of the two stored items.
A method getMin that returns the smaller of the two stored items.
A method setItems that takes in two constant items by reference and sets item1 and item2 to them.
A method getItem1 that returns item1.
A method getItem2 that returns item2.

Make a appropriate methods const so they don't alter item1 or item2 if not needed.

You should have a Pair. h and Pair. cpp file.

Create a pairTest. cpp file with a main() that creates two pairs, one that houses ints an one that houses strings.
Test all the methods for these two Pairs in your main and display the results.

ansver
Answers: 2

Another question on Engineering

question
Engineering, 04.07.2019 18:20
Aheavily insulated piston-cylinder device contains 0.02 m3 of steam at 300 kpa and 200 °c. 1.2 mpa. d this process. team is now compressed in a reversible manner to a pressure of etermine the entropy change and the work done on the steam during this process
Answers: 1
question
Engineering, 04.07.2019 19:10
Starting wih an energy balance on a rectangular volume element, derive the one- dimensional transient heat conduction equation for a plane wall with constant thermal conductivity and no heat generation.
Answers: 1
question
Engineering, 06.07.2019 03:10
Steel balls 12 mm in diameter are annealed by heating to 1150 k and then slowly cooled to 400 k in an air att 325 k and h -20 w/m2 k. assume the properties of the steel to be k- 40 w/m k,p 7800 kg/m3, and cp 600 j/kg k. a. determine whether lumped system method can be used to analyze this problem and if so why" b. determine the time required for the cooling process. c. determine the total amount of heat lost from each ball to the ambient air
Answers: 1
question
Engineering, 06.07.2019 03:20
Steam at a pressure of 100 kpa and a quality of 50% initially fills a rigid vessel having a volume of 0.5 m^3. the steam is then heated, causing the pressure in the vessel to rise to 150 kpa. determine: i. the mass of the steam in the vessel. ii. the temperature and quality of the steam after the heating process. ii the mass of the vapour, mg and liquid, m in the vessel after the heating process. if the steam in the vessel is now further heated, what would the pressure and temperature in the vessel be when all steam has turned into saturated vapour? b. sketch the processes in part (a) and part (b) on p-v and t-v diagrams, indicating clearly the temperatures, pressures and the paths. c. (0.59kg, 111.4°c, 73%, 0.4307kg, 0.1 593kg, 2.11 bar, 121.84°c)
Answers: 1
You know the right answer?
C++ Programming

Create a class template Pair that houses 2 items of datatype T.
Wh...
Questions
question
Mathematics, 14.07.2020 02:01
question
Mathematics, 14.07.2020 02:01
question
Mathematics, 14.07.2020 02:01
question
Mathematics, 14.07.2020 02:01
Questions on the website: 13722359