C++ MinMax Project

I need to have this by 15:00 EST 11/19/2013.

Define a class called MinMax that has the following properties. For exceptions, use the class MyException seen in class with an integer code and a string reason as members and << overloaded for display or overload the public method what().

• It has two private integer members called mMin and mMax. mMax is always larger or equal than mMin.

• Has a default constructor that sets both members to 0.

• A constructor that accepts two integers, the first for the max value and second for the min value. If the first is smaller than the second then the constructor trows and exception “Code 10: Invalid inputs, Max smaller than Min”.

• Provide separate mutator and accessor functions for mMin and mMax. (hint: changing anyone can change which is smaller and which is larger).

• Overload the operator << to display mMin and mMax.

• Overload the operator prefix and postfix ++ to increase each mMax and mMin by one.

• Overload operator + between two MinMax objects that should return a MinMax object.

• Overload operator * between a MinMax object and an integer returning a MinMax object by multiplying both mMax and mMin by the integer. (hint: the integer can be of any sign)

• Overload the operator [] to return mMax for [0] (index 0) and mMin for index 1, it throws an exception “Code 20: out of bounds” if index is not 0 or 1.

• What would be the output of the following main

void main () {

MinMax n1(2, 1), n2;

int var = -5;

try { MinMax n3 = n2 + n1;

cout << “n3 = “ << n3 << endl;

n2 = n1++;

cout << “n1 = “ << n1 << “ n2 = “ << n2 << endl;

n3 = (++n1) * var;

cout << “n1 = “ << n1 << “ n3 = “ << n3 << endl;

MinMax n4(2, 5);

n1 = n1 + n4;

cout << “n1 = “ << n1 << “ n4 = “ << n4 << endl;

catch(MyException &e) {

[url removed, login to view](); }

try { var = n1[1];

cout << “var = “ << var << endl;

var = n1[2];

cout << “var = “ << var << endl;

}catch(MyException &e) {

[url removed, login to view]();



Habilidades: Programação C++

Ver mais: what need for an operator, what is a string in programming, what is a class in programming, string prefix, string cplusplus, programming what is a class, programming operator, prefix string, prefix of a string, n3, est define, define est, define c programming, c programming string functions, c programming operator, c programming define, cplusplus string, 0 1 integer programming, increase value of project, endl, overloaded operator, class programming project, use programming class project, integers larger equal, est programming

Acerca do Empregador:
( 25 comentários ) Long Island City, United States

ID do Projeto: #5142725

Premiar a:


Contact me for an efficient, perfect, well documented development of your project according to 100% accuracy and requirements, with dedicated support. Thanks

$25 USD em 1 dia
(14 Avaliações)

4 freelancers are bidding on average $26 for this job


Hello. I am C/C+ expert but I am able to wrote code in "beginner manner", there is possible to complete project in few hours.

$23 USD em 1 dia
(138 Comentários)

hi... i can do this. i already worked on this project. please let me know if you need my help. i will deliver you asap. thanks

$30 USD in 0 dias
(8 Comentários)

A proposal has not yet been provided

$25 USD em 1 dia
(0 Comentários)