SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 304 Weeks Ago, 5 Days Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 08 Nov 2017 My Price 10.00

Hello, could someone help write me a dump function and a copy constructor for my code?

Hello, could someone help write me a dump function and a copy constructor for my code? Could someone also help write two functions for me?

bool combine(const PeopleList& m1, const PeopleList& m2, PeopleList& result);

When this function returns, result must consist of pairs determined by these rules:

  • If a full name appears in exactly one of m1 and m2, then result must contain an element consisting of that full name and its corresponding value.
  • If a full name appears in both m1 and m2, with the same corresponding value in both, then result must contain an element with that full name and value.

When this function returns, result must contain no elements other than those required by these rules. (You must not assume result is empty when it is passed in to this function; it might not be.)

If there exists a full name that appears in both m1 and m2, but with different corresponding values, then this function returns false; if there is no full name like this, the function returns true. Even if the function returns false, result must be constituted as defined by the above rules.

For example, suppose a PeopleList maps the full name to integers. If m1 consists of these three elements

     "Ethel" "Mertz"  456      "Fred" "Mertz"  123      "Lucy" "Ricardo"  789

and m2 consists of

     "Lucy" "Ricardo"  789      "Ricky" "Ricardo" 321

then no matter what value it had before, result must end up as a list consisting of

     "Ethel" "Mertz"  456     "Fred" "Mertz"  123      "Lucy" "Ricardo"  789      "Ricky" "Ricardo"  321

and combine must return true. If instead, m1 were as before, and m2 consisted of

     "Lucy" "Ricardo" 654      "Ricky" "Ricardo"  321

then no matter what value it had before, result must end up as a list consisting of

     "Ethel" "Mertz" 456      	"Fred" "Mertz"  123      "Ricky" "Ricardo"  321

and combine must return false.

void psearch (const std::string& fsearch, const std::string& lsearch, 
             const PeopleList& p1, PeopleList& result);

When this function returns, result must contain a copy of all the elements in m1 that match the search terms; it must not contain any other elements. You can wildcard the first name, last name or both by supplying "*". (You must not assume result is empty when it is passed in to this function; it may not be.)

For example, if p consists of the three elements

      "Gustavo" "Fring"  57      "Skyler" "White"  45      "Walter" "White" 52 

and the following call is made:

      psearch("*", "White", p, result)

then no matter what value it had before, result must end up as a PeopleList consisting of

      "Skyler" "White"  45       "Walter" "White" 52

If instead, p1 were   

   "Jane" "Doe" 35            "Marie" "Schrader" 37      "Jane" "Margolis" 27

and the following call is made:

      psearch("Jane", "*", p, result)

then no matter what value it had before, result must end up as a list consisting of

      "Jane" "Doe" 35            "Jane" "Margolis" 27

 

and if the following call is made:      psearch("*", "*", p, result)

then no matter what value it had before, result must end up being a copy of p

Be sure these functions behave correctly in the face of aliasing: What if m1 and result refer to the same PeopleList, for example?

Please help, I am lost with these two functions.

Answers

(5)
Status NEW Posted 08 Nov 2017 10:11 AM My Price 10.00

----------- He-----------llo----------- Si-----------r/M-----------ada-----------m -----------Tha-----------nk -----------you----------- fo-----------r y-----------our----------- in-----------ter-----------est----------- an-----------d b-----------uyi-----------ng -----------my -----------pos-----------ted----------- so-----------lut-----------ion-----------. P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll -----------be -----------qui-----------ckl-----------y

Not Rated(0)