Design the class doctorType, inherited from the class personType, defined in Chapter 10, with an additional data member to store a doctor’s specialty. Add appropriate constructors and member functions to initialize, access, and manipulate the data members. Design the class billType with data members to store a patient’s ID and a patient’s hospital charges, such as pharmacy charges for medicine, doctor’s fee, and room charges. Add appropriate constructors and member functions to initialize, access, and manipulate the data members. If no value is provided for a charge, it should default to 0. Design the class patientType, inherited from the class personType, defined in Chapter 10, with additional data members to store a patient’s ID, age, date of birth, attending physician’s name, the date when the patient was admitted in the hospital, and the date when the patient was discharged from the hospital. (Use the class dateType to store the date of birth, admit date, discharge date, and the class doctorType to store the attending physician’s name.) Add appropriate constructors and member functions to initialize, access, and manipulate the data members. Write a program to test your classes
Design the class doctorType, inherited from the class personType, defined in Chapter 10, with an additional data member to store a doctor’s specialty. Add appropriate constructors and member functions to initialize, access, and manipulate the data members. Design the class billType with data members to store a patient’s ID and a patient’s hospital charges, such as pharmacy charges for medicine, doctor’s fee, and room charges. Add appropriate constructors and member functions to initialize, access, and manipulate the data members. If no value is provided for a charge, it should default to 0. Design the class patientType, inherited from the class personType, defined in Chapter 10, with additional data members to store a patient’s ID, age, date of birth, attending physician’s name, the date when the patient was admitted in the hospital, and the date when the patient was discharged from the hospital. (Use the class dateType to store the date of birth, admit date, discharge date, and the class doctorType to store the attending physician’s name.) Add appropriate constructors and member functions to initialize, access, and manipulate the data members. Write a program to test your classes
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
- Design the class doctorType, inherited from the class personType, defined in Chapter 10, with an additional data member to store a doctor’s specialty. Add appropriate constructors and member functions to initialize, access, and manipulate the data members.
- Design the class billType with data members to store a patient’s ID and a patient’s hospital charges, such as pharmacy charges for medicine, doctor’s fee, and room charges. Add appropriate constructors and member functions to initialize, access, and manipulate the data members. If no value is provided for a charge, it should default to 0.
- Design the class patientType, inherited from the class personType, defined in Chapter 10, with additional data members to store a patient’s ID, age, date of birth, attending physician’s name, the date when the patient was admitted in the hospital, and the date when the patient was discharged from the hospital. (Use the class dateType to store the date of birth, admit date, discharge date, and the class doctorType to store the attending physician’s name.) Add appropriate constructors and member functions to initialize, access, and manipulate the data members.
- Write a program to test your classes
Photos of personType are attached below

Transcribed Image Text:bte320.pdf - Adobe Acrobat Pro DC (32-bit)
File Edit View E-Sign Window Help
Home Tools
bte320.pdf
—
Bookmarks
X
D
@
DA
Table of Contents
Chapter1: AN
OVERVIEW Of
COMPUTERS AND
PROGRAMMING
LANGUAGES
> Chapter2: BASIC
ELEMENTS OF C++
> Chapter3:
INPUT/OUTPUT
> Chapter4: Control
Structures I (Selection)
> Chapter5: Control
>
Structrues II (Repetition)
Chapter6: User-Defined
Functions
>
Chapter7: User-Defined
Simple Date Types,
Namespaces, and the
string Type
> Chanter8: Arrays and
>
X
696 (746 of 1491)
55.3%
696 Chapter 10: Classes and Data Abstraction
void setName(string first, string last);
//Function to set firstName and last Name according
//to the parameters.
//Postcondition: firstName = first; last Name = las
string getFirstName () const;
//Function to return the first name.
//Postcondition: The value of firstName is returne
string getLastName() const;
//Function to return the last name.
//Postcondition: The value of lastName is returned.
personType (string first = "", string last = "");
//Constructor
//Sets firstName and lastName according to the parameters.
//The default values of the parameters are null strings.
//Postcondition: firstName = first; lastName = last
private:
string firstName; //variable to store the first name
string lastName; //variable to store the last name
Figure 10-11 shows the UML class diagram of the class personType.
personType
-firstName: string
-las tName: string
+print (): void
+setName (string, string): void
+getFirstName() const: string
+getLastName () const: string
+personType (string = "", string = "")
FIGURE 10-11 UML class diagram of the class personType
We now give the definitions of the member functions of the class personType.
void personType: :print () const
{
cout << firstName << " " << lastName;
}
void personType::setName (string first, string last)
{
firstName = first;
lastName = last;
}
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Find
persontype
Previous
▸ Replace with
Next
OneDrive
T
[4
2.
Search tools
D
X
Create PDF
Combine Files
Edit PDF
Fill & Sign
Export PDF
Organize Pages
NEW
Send for Comme...
Comment
x
Screenshot saved
The screenshot was added to your
OneDrive.
More Tools
X

Transcribed Image Text:bte320.pdf - Adobe Acrobat Pro DC (32-bit)
File Edit View E-Sign Window Help
Home Tools
bte320.pdf
—
Bookmarks
X
D
@
DA
Table of Contents
Chapter1: AN
OVERVIEW Of
COMPUTERS AND
PROGRAMMING
LANGUAGES
> Chapter2: BASIC
ELEMENTS OF C++
> Chapter3:
INPUT/OUTPUT
> Chapter4: Control
Structures I (Selection)
> Chapter5: Control
Structrues II (Repetition)
Chapter6: User-Defined
Functions
>
>
Chapter7: User-Defined
Simple Date Types,
Namespaces, and the
string Type
> Chanter8: Arrays and
>
X
695 (745 of 1491)
55.3%
More Examples c
cout << "Line 14: The sum of the numbers rolled"
<< by the dice is: "
<< diel.getNum () + die2.getNum () << endl; //L:
diel.roll();
die2.roll();
//L
//L
cout << "Line 17: After again rolling, the sum
<< "the numbers rolled is: "
of "
<< diel.getNum () + die2.getNum () << endl;
//L
return 0;
}//end main
//Line 18
//Line 19
Sample Run:
Line 8: diel: 1
Line 9: die2: 1
Line 11: After rolling diel: 4
Line 13: After rolling die2: 3
Line 14: The sum of the numbers rolled by the dice is: 7
Line 17: After again rolling, the sum of the numbers rolled is: 8
The preceding program works as follows. The statements in Lines 6 and 7 create
the objects diel and die2, and using the default constructor set both dice to 1. The
statements in Lines 8 and 9 output the number of both dice. The statement in Line 10
rolls diel and statement in Line 11 outputs the number rolled. Similarly, the
statement in Line 12 rolls die2 and the statement in Line 13 outputs the number
rolled. The statement in Line 14 outputs the sum of the numbers rolled by diel and
die2. The statements in Lines 15 and 16 again rolls both dice and the statement in
Line 17 outputs the sum of the numbers rolled.
1
0
The class personType that is designed in Example 10-10 is very useful; we will use
this class in subsequent chapters.
EXAMPLE 10-10
The most common attributes of a person are the person's first and last name. The
typical operations on a person's name are to set the name and print the name. The
following statements define a class with these properties.
#include <string>
using namespace std;
class personType
{
public:
void print () const;
//Function to output the first name and last name
//in the form firstName lastName.
Copyright 2018 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. WCN 02-200-203
Find
persontype
Previous
▸ Replace with
Next
T
[4
2.
Search tools
D
X
Create PDF
Combine Files
Edit PDF
Fill & Sign
Export PDF
Organize Pages
NEW
Send for Comme...
Comment
Scan & OCR
Protect
More Tools
X
Expert Solution

Trending now
This is a popular solution!
Step by step
Solved in 10 steps with 1 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY