Create a base class called Device which includes the basic attributes and member functions related to any digital device. The data members of this class include the following: String variable which contains the device name. Double variable which is the price of the device. For this class you should provide the following public member functions: a) Provide a constructor function that enables an object of this class to be initialized when it is declared. b) Info(): prints all the data related to any device object. c) Set and get functions for all data members. d) Destructor that prints any statement you want. Write another class called Mobile which is derived from class Device. Class Mobile includes the following additional private data members: Double variable which contains the CPU speed of the mobile. Integer variable that contains the RAM size. For this class you should provide the following public member functions: a) Provide a constructor function that enables an object of this class to be initialized when it is declared. The constructor should contain default values (for the base and derived classes' data members) in case no initializers are provided. b) MobileInfo () function in the appropriate format. This function should print all data member values. c) One set function for all data members. d) Get functions for all data members. e) Destructor that call function Mobileinfo() then print "Bye". In the main, you have to test the member functions of the base and derived class.

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...
icon
Related questions
Question
Create a base class called Device which includes the basic attributes and member functions related to any digital
device. The data members of this class include the following:
String variable which contains the device name.
Double variable which is the price of the device.
For this class you should provide the following public member functions:
a) Provide a constructor function that enables an object of this class to be initialized when it is declared.
b) Info(): prints all the data related to any device object.
c) Set and get functions for all data members.
d) Destructor that prints any statement you want.
Write another class called Mobile which is derived from class Device.
Class Mobile includes the following additional private data members:
Double variable which contains the CPU speed of the mobile.
Integer variable that contains the RAM size.
For this class you should provide the following public member functions:
a) Provide a constructor function that enables an object of this class to be initialized when it is declared. The
constructor should contain default values (for the base and derived classes' data members) in case no
initializers are provided.
b) Mobilelnfo () function in the appropriate format. This function should print all data member values.
c) One set function for all data members.
d) Get functions for all data members.
e) Destructor that call function Mobileinfo() then print "Bye" .
In the main, you have to test the member functions of the base and derived class.
Transcribed Image Text:Create a base class called Device which includes the basic attributes and member functions related to any digital device. The data members of this class include the following: String variable which contains the device name. Double variable which is the price of the device. For this class you should provide the following public member functions: a) Provide a constructor function that enables an object of this class to be initialized when it is declared. b) Info(): prints all the data related to any device object. c) Set and get functions for all data members. d) Destructor that prints any statement you want. Write another class called Mobile which is derived from class Device. Class Mobile includes the following additional private data members: Double variable which contains the CPU speed of the mobile. Integer variable that contains the RAM size. For this class you should provide the following public member functions: a) Provide a constructor function that enables an object of this class to be initialized when it is declared. The constructor should contain default values (for the base and derived classes' data members) in case no initializers are provided. b) Mobilelnfo () function in the appropriate format. This function should print all data member values. c) One set function for all data members. d) Get functions for all data members. e) Destructor that call function Mobileinfo() then print "Bye" . In the main, you have to test the member functions of the base and derived class.
Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
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 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)
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
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY