1 answer

Please do this in C++. Thank you in advance. Note that you have to carefully create...

Question:

Please do this in C++. Thank you in advance.

Note that you have to carefully create your class using the names and capitalization shown below. Put comments into your program, make sure you indent your program properly, and use good naming conventions.

Create a class called entry. It should have two private data members of type std::string. One represents a name and the other represents an email address. Make sure you give them ,meaningful names.

Create public getters and setters for the two strings with the following signatures:

string getName() const;

void setName(string newName);

string getEmail() const;

void setEmail(string newEmail);

The entry class also needs two constructors. One that takes no parameters and sets both std::string values to "". The second one should have two std::string parameters. The first parameter is the name and and the second one is the email address.

You must not inline the constructors. You can, optionally, inline some or all of the remaining member functions.

Create your main function and create two instances of the entry class. The first one must use the default constructor and the second one must use the constructor that takes two parameters. Give the parameters the text "Susan Smith" and "[email protected]".

Your main function should output the contents of the name for the first entry object and the email of the second entry object. Your main function will call the appropriate getter member functions to get the values for name and email. Your main function should output the text with no headings or extra characters, but do output a std::endl after outputting the name and again after outputting the email.

Note that some of the tests are unit tests where I will create entry objects and call the various getters and setters. Note that you will be creating the entry class and the main function all in the same input file.


Answers

// do comment if any problem arises

//code

//answer has been highlighted

#include <iostream>

using namespace std;

class entry

{

private:

    string name, email;

public:

    // getter for name

    string getName() const

    {

        return name;

    }

    // setter for name

    void setName(string newName)

    {

        name = newName;

    }

    // getter for email

    string getEmail() const

    {

        return email;

    }

    // setter for email

    void setEmail(string newEmail)

    {

        email = newEmail;

    }

    // default constructor

    entry()

    {

        name = "";

        email = "";

    }

    // perameterized  constructor

    entry(string temo_name, string temo_email)

    {

        name = temo_name;

        email = temo_email;

    }

};

int main()

{

    // create 2 entry objects

    entry first, second("Susan Smith", "[email protected]");

    // print name of first object

    cout << first.getName() << endl;

    // print email of second object

    cout << second.getEmail();

}

Output:

PS E:\fixer> .\a.exe sue@example.com PS E:\fixer>.

PS E:\fixer> .\a.exe [email protected] PS E:\fixer>.

PS E:\fixer> .\a.exe [email protected] PS E:\fixer>.

.

Similar Solved Questions

1 answer
Dumping occurs when a firm A. sells too much of a good in a foreign country....
Dumping occurs when a firm A. sells too much of a good in a foreign country. B. sells in a foreign country at prices that are below fair value. C. sells in its home market at prices that are below the average price charged by its competitors. D. sells exports in a foreign market ...
1 answer
Udent.php?sz=c0009a7e&w=49048,3499409,0 Critical thinking question 27.3 (p.633) You are a medical examiner and are asked to determine...
udent.php?sz=c0009a7e&w=49048,3499409,0 Critical thinking question 27.3 (p.633) You are a medical examiner and are asked to determine the cause of death of a body brought to the morgue You find a very large agglutination (not a clot) in a major vein. Based on this, what judgment would you make r...
1 answer
CALCULATOR FULL SCREEN PRINTER VERSION BACK NEXT Brief Exercise 16-5 The Smelting Department of Kiner Company...
CALCULATOR FULL SCREEN PRINTER VERSION BACK NEXT Brief Exercise 16-5 The Smelting Department of Kiner Company has the following production and cost data for November Production: Beginning work in process 3,700 units that are 100% complete as to materials and 23% complete as to conversion costs; unit...
1 answer
A) if three samples of KHP weighing , 31.21 mg +- 4.3 % ; 81.4 mg...
a) if three samples of KHP weighing , 31.21 mg +- 4.3 % ; 81.4 mg +- 7.12% and 213.2 mg +- 8.4% were added together, determine the total mass of KHP and its absolute uncertainty. Express the anwer with the correct number of significant figures. b) If the mass of KHP from part(a) of this problem were...
1 answer
Score: 0 of 1 pt 6 of 11 (0 complete) E2-18 (similar to) The following transactions...
Score: 0 of 1 pt 6 of 11 (0 complete) E2-18 (similar to) The following transactions occurred for Warren Technology Solutions (Click the icon to view the transactions.) Read the requirement (Record debits first, then credits. Select the explanation on the last line of the journal entry table) May 1: ...
1 answer
Cherry Corporation, a calendar year C corporation, is formed and begins business on 8/1/2019. In connection...
Cherry Corporation, a calendar year C corporation, is formed and begins business on 8/1/2019. In connection with its formation, Cherry incurs organizational expenditures of $51,200. Round the per month amount to two decimal places. Round your final answer to the nearest dollar. Determine Cherry Corp...
1 answer
Whispering Winds Corp. has the following securities in its portfolio of equity securities on December 31,...
Whispering Winds Corp. has the following securities in its portfolio of equity securities on December 31, 2021: 5,000 shares of Thomas Corp., Common 10,000 shares of Gant, Common Cost $151,000 180,000 $331,000 Fair Value $138,600 187,700 $326,300 All of the securities had been purchased in 2021. In ...
1 answer
Problem 3 (10 points) z 0.2 m 0.15 m A cube has a side of length...
Problem 3 (10 points) z 0.2 m 0.15 m A cube has a side of length 0.200 m, with one corner at the origin. A point charge q = 7.00 uC is located in- side the cube. A thin plane of charge, with charge density o= 1.750 x 104 C/m² is parallel to the X-Y plane and intersects the cube at z= 0.150 m (a...
1 answer
What is the best meal to help reduce LDL cholesterol levels in the blood? O roast...
What is the best meal to help reduce LDL cholesterol levels in the blood? O roast beef, mashed potatoes, tossed salad, sourdough bread Opinto beans and ham, corn on the cob with margarine, cornbread O grilled salmon, wild rice, steamed broccoli, and whole wheat roll O roasted chicken, sweet potatoes...
1 answer
Parasaurolophus was a dinosaur whose distinguishing feature was a hollow crest on the head. The 1.6...
Parasaurolophus was a dinosaur whose distinguishing feature was a hollow crest on the head. The 1.6 - m - long hollow tube in the crest had connections to the nose and throat, leading some investigators to hypothesize that the tube was a resonant chamber for vocalization. If you model the tube as a...
1 answer
Western World Inc. issues $40,000,000 of convertible bonds with each $1,000 bond convertible into 15 shares...
Western World Inc. issues $40,000,000 of convertible bonds with each $1,000 bond convertible into 15 shares of the company’s $1 par common stock.  The bonds are issued at 103 on January 1, 2020 and pay interest in Jan and July and mature on January 1, 2025.   On July 1...
1 answer
1-The profession's ethical standards would most likely be considered to have been violated when a CPA:...
1-The profession's ethical standards would most likely be considered to have been violated when a CPA: a. Continued an audit engagement after the commencement of litigation against the CPA alleging excessive fee filed in a stockholder's derivative action b- Represented to a potential client ...
1 answer
You have just been hired by FAB Corporation, the manufacturer of a revolutionary new garage door...
You have just been hired by FAB Corporation, the manufacturer of a revolutionary new garage door opening device. The president has asked that you review the company’s costing system and “do what you can to help us get better control of our manufacturing overhead costs.” You find th...
1 answer
A football is thrown with an initial upward velocity component of 16.9 m/s and a horizontal...
a football is thrown with an initial upward velocity component of 16.9 m/s and a horizontal velocity component of18.7 m/s. Ignore air resistance. How much time is required for the football to reach the highest point of the trajectory? Howhigh is this point? How much time (after it is thrown) is requ...
1 answer
Kingbird, Inc., spent $55,800 in attorney fees while developing the trade name of its new product,...
Kingbird, Inc., spent $55,800 in attorney fees while developing the trade name of its new product, the Mean Bean Machine. Prepare the journal entries to record the $55,800 expenditure and the first year’s amortization, using an 6-year life. Use the account title "Trade Names". (Credit...