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 "sue@example.com".
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.
// 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", "sue@example.com");
// 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 sue@example.com PS E:\fixer>.
Please do this in C++. Thank you in advance. Note that you have to carefully create...
Godzilla Class Pt. 2 C++
I have to continue building off of this class and do the
following
I got help with the code below but could use some guidance as to
how to finish this out. Any help would be appreciated
This is the code for the main.cpp
#include <iostream>
#include "Godzilla.h"
using namespace std;
int main() {
double health;
double power;
//prompt the user to input the health and power for Godzilla
cout<< "Enter the health: " ;...
An abstract class doesn't have a constructor (because you cannot make an object of the abstract class). It should have at least one method, which then has to be overridden in all derived classes. Here is an example: abstract void run(); class Honda4 extends Bike{ public static void main(String args[]){ obj.run(); } You are to create an abstract class called Shape, which has an abstract method called computeArea(). Derive a Circle class from Shape. (Circle is similar to your previous...
Please submit the following files for this assignment: *****************Animal.h, Animal.cpp, Mammal.h, Mammal.cpp, Cat.h, Cat.cpp, main.cpp********* Assignment 4 – OOP – inheritances Create a base class Animal (Animal.h, Animal.cpp) Member variables (private): string name; string type; Member methods (public): Constructor(s) Setters Getters eat(); //display “Eat food.” Create a derived class Mammal from Animal (public) (Mammal.h, Mammal.cpp) Member variables (private): string hair_type; //eg: fur, hair,etc Member methods (public): Constructor(s) Setters Getters Create a derived class Cat from Mammal (public) (Cat.h, Cat.cpp) Member...
Create Student class•Change header so that Student extends Person•A Student has-an additional instance variable, major of type String.•Add the instance variable, its getters and setters. •Add a toString method to the Student class. It should reuse the toString method of Person. •Add two constructors: –No args–Constructor that receives the student’s name, birth year and Major as parameters•Create a class TestInheritance3–Create 2 Student objects–Create an Instructor object–Print the information about the two students and the instructor using the getters of Person,...
Create a NetBeans project called "Question 1". Then create a public class inside question1 package called Author according to the following information (Make sure to check the UML diagram) Author -name:String -email:String -gender:char +Author(name:String, email:String, gender:char) +getName():String +getEmail):String +setEmail (email:String):void +getGender():char +tostring ):String . Three private instance variables: name (String), email (String), and gender (char of either 'm' or 'f'): One constructor to initialize the name, email and gender with the given values . Getters and setters: get Name (), getEmail() and getGender (). There are no setters for name and...
Write a C++ program for the instructions below. Please
read the instructions carefully and make sure they are followed
correctly.
and please put comment with code!
Problem:2 1. Class Student Create a "Hello C++! I love CS52" Program 10 points Create a program that simply outputs the text Hello C++!I love CS52" when you run it. This can be done by using cout object in the main function. 2. Create a Class and an Object In the same file as...
When answering this question, can you please specify what you name your files? Thank you! Write a Java application, and an additional class to represent some real-world entity. Keep in mind that a class is a model in code of something real or imagined, which has attributes (member variables) and behaviors (member methods). The class will: a. Create a total of 5 member variables for the class, selecting the appropriate data types for each field. For example, a class to...
java. Question 2: Practice Polymorphism- Food A Assume you have a parent class called Food with one instance data variable: private String name. The class has one constructor that takes the name as a parameter, getters and setters for name, and a toString that outputs the name. Write a child class called Vegetable with one additional variable describing whether or not the vegetable is green. Write two constructors: one that takes in all information about a vegetable and one that...
C++ programming question, please help! Thank you so much in advance!!! In this exercise, you will work with 2 classes to be used in a RPG videogame. The first class is the class Character. The Character class has two string type properties: name and race. The Character class also has the following methods: a constructor Character(string Name, string Race), that will set the values for the name and the race variables set/get functions for the two attributes a function print(),...
for c++ answer the following and create the following (1)Declare a class to hold Employee Data. It must have at least 2 attributes and 1 method in addition to getters/setters for 1 of the 2 attributes. Also, include at least 2 constructors and a destructor. Put the appropriate members in public and private sections. You don't need to write the code to implement the class except for getters and setters which should include the appropriate inline code. (2) What is/are...