Question: Use the following C++ class to create a working implementation in Java. You are welcome to write a separate class containing the main method to

Use the following C++ class to create a working implementation in Java. You are welcome to write a separate class containing the main method to test out your class, but it is not required for this quiz. Please put this class in the following package: cpsc2150.quizzes

#include  using namespace std; class Person { public: // Constructor: sets firstName and lastName according to the parameters. // @pre [ first and last names are valid ] // @post firstName = first AND lastName = last Person(string first, string last); // Function to output the first name and last name in the form (with a space separating the two strings): firstName lastName // @pre None // @post [ Output person's name to console ] AND firstName = #firstName AND lastName = #lastName void print() const; // Function to set firstName and lastName according to the parameters // @pre [ first and last names are valid ] // @post firstName = first AND lastName = last void setName(string first, string last); // Function to return the first name // @pre None // @post getFirstName = firstName AND firstName = #firstName AND lastName = #lastName string getFirstName() const; // Function to return the last name // @pre None // @post getLastName = lastName AND firstName = #firstName AND lastName = #lastName string getLastName() const; private: string firstName; string lastName; };

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!