Create a class called Person that will hold information about a single individual. This class should have a data section that consists of the following: Variable Name Data Type firstName string lastName string address string The Person class should have the following mutators: setFirstName(string first); setLastName(string last); setAddress(string address); The Person class should have the following accessors: string getFirstName(); string getLastName(); string getAddress(); The Person class should have the following constructors: Person(); - default Person(string first, string last); - Set other fields to an empty string Person(string first, string last, string address); Note: You must use delegating constructors to eliminate duplicate code. Main Create an array which will hold 5 Person classes. Pass the array to a function called getPeople which will fill out the array with information about people taken from the keyboard. Create a second function called printPeople which will take the array of Person's and print it to the console window. Please format the output so that it can be easily read and understood. Please can you write it in C++ coding form because I never took Java. Can you help me solve this problem in C++ forms using the Classes / Constructors method like: main.cpp Person.h Person.cpp PLease write the coding in c++ forms. As well using the comment method because I can fuse how to due this comment method
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Create a class called Person that will hold information about a single individual. This class should have a data section that consists of the following:
Variable Name |
Data Type |
firstName |
string |
lastName |
string |
address |
string |
The Person class should have the following mutators:
-
setFirstName(string first);
-
setLastName(string last);
-
setAddress(string address);
The Person class should have the following accessors:
-
string getFirstName();
-
string getLastName();
-
string getAddress();
The Person class should have the following constructors:
-
Person(); - default
-
Person(string first, string last); - Set other fields to an empty string
-
Person(string first, string last, string address);
Note: You must use delegating constructors to eliminate duplicate code.
Main
Create an array which will hold 5 Person classes. Pass the array to a function called getPeople which will fill out the array with information about people taken from the keyboard. Create a second function called printPeople which will take the array of Person's and print it to the console window. Please format the output so that it can be easily read and understood.
Please can you write it in C++ coding form because I never took Java.
Can you help me solve this problem in C++ forms using the Classes / Constructors method like:
main.cpp
Person.h
Person.cpp
PLease write the coding in c++ forms.
As well using the comment method because I can fuse how to due this comment method
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images