Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello, this is a C++ problem, can someone help me? Project 1: Fuller Mailbox I h

ID: 639398 • Letter: H

Question

Hello, this is a C++ problem, can someone help me?

Project 1: Fuller Mailbox
I have provided you with a sample class named Mailbox which has been diagrammed below. You can acquire the source to the Mailbox class by clicking on the link for your development environment ( VS2012 XCode5 ). Using the Mailbox class provided earlier, upgrade the class so that it supports various operators. Make operator+ combine together the contents of two Mailbox, as long as the contents does not exceed the size. Make operator- subtract one Mailbox contents from another, as long as the size or contents don't go negative. Support the >> and << operators to allow instances to be read from cin or written to cout. Make the boolean operators <, >, <= and >= test Mailbox's contents. Make the boolean operator == and != test all of the data members of a Mailbox for an exact match.

Mailbox

void setSize( int amount );
int getSize( );
void setAddress( string address );
string getAddress();
int getContents();

void pickupMail();
int deliverMail( int pieces );

Mailbox yours( "your address" );
Mailbox mine( "1900 Pico Boulevard" );
Mailbox test( "test" );

yours.setSize( 10 );
mine.setSize( 10 );
test.setSize( 5 );

yours.deliverMail( 5 );
mine.deliverMail( 6 );
test.deliverMail( 5 );


test = yours + mine;
/// contents will become negative...
/// this should print an error
test = yours - mine;


/// test should have 11 pieces of mail
test = yours + mine;
cout << test;

if (test > yours) {
cout <<"test is bigger"<< endl;
}
if (test >= mine) {
cout <<"test is bigger or equal"<< endl;
}
if (yours < mine) {
cout<<"yours is smaller"<<endl;
}
if (yours <= test) {
cout<<"yours is smaller or equal"<<endl;
}
if (yours != test) {
cout <<"yours != test!"<<endl;
}
if (yours == yours) {
cout <<"equal test works"<<endl;
}

Implementation Details Sample Driver

Mailbox

Mailbox();
Mailbox( string address );

void setSize( int amount );
int getSize( );
void setAddress( string address );
string getAddress();
int getContents();

void pickupMail();
int deliverMail( int pieces );

string my_Address;
int my_Size;
int my_Contents;

Mailbox yours( "your address" );
Mailbox mine( "1900 Pico Boulevard" );
Mailbox test( "test" );

yours.setSize( 10 );
mine.setSize( 10 );
test.setSize( 5 );

yours.deliverMail( 5 );
mine.deliverMail( 6 );
test.deliverMail( 5 );


test = yours + mine;
/// contents will become negative...
/// this should print an error
test = yours - mine;


/// test should have 11 pieces of mail
test = yours + mine;
cout << test;

if (test > yours) {
cout <<"test is bigger"<< endl;
}
if (test >= mine) {
cout <<"test is bigger or equal"<< endl;
}
if (yours < mine) {
cout<<"yours is smaller"<<endl;
}
if (yours <= test) {
cout<<"yours is smaller or equal"<<endl;
}
if (yours != test) {
cout <<"yours != test!"<<endl;
}
if (yours == yours) {
cout <<"equal test works"<<endl;
}

Sample Output Can

Explanation / Answer

#include #include #define CAPACITY 150 using namespace std; int everyOther(int []); int everyNthBox(int []); int main() { int mailbox[CAPACITY] = {0}; //0 closed, 1 open everyOther(mailbox); everyNthBox(mailbox); //test display cout