Example 10-10 defined a class personType to store the name of a person. The member functions that we included merely print the name and set the name of a person. Redefine the class personType so that, in addition to what the existing class does, you can: Set the first name only. Set the last name only. Store and set the middle name. Check whether a given first name is the same as the first name of this person. Check whether a given last name is the same as the last name of this person.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Example 10-10 defined a class personType to store the name of a person. The member functions that we included merely print the name and set the name of a person. Redefine the class personType so that, in addition to what the existing class does, you can:

  • Set the first name only.
  • Set the last name only.
  • Store and set the middle name.
  • Check whether a given first name is the same as the first name of this person.
  • Check whether a given last name is the same as the last name of this person.
O (829) K
O Home
O Merritt
C-25_T
O Prograr : Min x
O PHYS 4
O cis25 la
O cis25 la
E Untitlec
E Untitlec
ь Му Que
T Subscr
O (Solved
b Verify E
M Inbox (
G Google
+
ng.cengage.com/static/nb/ui/evo/index.html?deploymentld=5781122055515575690743039334&elSBN=9781337274715&snapshotld%=1982158&id=934535649&takeld=D002990dd-3047-4db4-a2. *
WILLIYAM v
CENGAGE MINDTAP
Q Search this course
A My Home
Programming Exercise 10-11
+
| Instructions
Courses
main.cpp
personType.h
personTypelmp.cpp
>- Terminal
1 #include "personType.h"
personTypelmp.cpp
Enter first name:
O Catalog and Study Tools
2 #include <string>
• Set the first name only.
3 #include <iostream>
A-Z
Partner Offers
Lll
• Set the last name only.
4
EE Rental Options
5 using namespace std;
• Store and set the middle name.
College Success Tips
• Check whether a given first name is
7 void PersonType::print() const
8 {
the same as the first name of this
Career Success Tips
9
cout << firstName << " " << middleName << " " <<
person.
lastName;
RECOMMENDED FOR YOU
10 }
• Check whether a given last name is
11
the same as the last name of this
12 void PersonType::setName(string first, string last)
13 {
person.
14
firstName = first;
15
lastName = last;
Check In! Sleep Self-
Write the definitions of the member
16 }
Assessment Take the quiz!]
functions to implement the operations
for this class . Also, write a program to
17
18 void PersonType::setFirstName(string f)
Help
test various operations on this class .
19 {
20
firstName = f;
Give Feedback
21 }
Grading
22
23 void PersonType: :setLastName(string 1)
When you have completed your
24 {
program, click the Submit button to
lastName = 1;
25
26 1
record your score.
6 V i 3:25
Transcribed Image Text:O (829) K O Home O Merritt C-25_T O Prograr : Min x O PHYS 4 O cis25 la O cis25 la E Untitlec E Untitlec ь Му Que T Subscr O (Solved b Verify E M Inbox ( G Google + ng.cengage.com/static/nb/ui/evo/index.html?deploymentld=5781122055515575690743039334&elSBN=9781337274715&snapshotld%=1982158&id=934535649&takeld=D002990dd-3047-4db4-a2. * WILLIYAM v CENGAGE MINDTAP Q Search this course A My Home Programming Exercise 10-11 + | Instructions Courses main.cpp personType.h personTypelmp.cpp >- Terminal 1 #include "personType.h" personTypelmp.cpp Enter first name: O Catalog and Study Tools 2 #include <string> • Set the first name only. 3 #include <iostream> A-Z Partner Offers Lll • Set the last name only. 4 EE Rental Options 5 using namespace std; • Store and set the middle name. College Success Tips • Check whether a given first name is 7 void PersonType::print() const 8 { the same as the first name of this Career Success Tips 9 cout << firstName << " " << middleName << " " << person. lastName; RECOMMENDED FOR YOU 10 } • Check whether a given last name is 11 the same as the last name of this 12 void PersonType::setName(string first, string last) 13 { person. 14 firstName = first; 15 lastName = last; Check In! Sleep Self- Write the definitions of the member 16 } Assessment Take the quiz!] functions to implement the operations for this class . Also, write a program to 17 18 void PersonType::setFirstName(string f) Help test various operations on this class . 19 { 20 firstName = f; Give Feedback 21 } Grading 22 23 void PersonType: :setLastName(string 1) When you have completed your 24 { program, click the Submit button to lastName = 1; 25 26 1 record your score. 6 V i 3:25
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education