Q2) Write C++ code to create class called number. The private data members for this class are nobl (double), nob2 (double) and nob3(double). The member function for this class is: 1- (Constructor) that accepts nobl, nob2 and nob3 as arguments (inside the class). Write a main() that create two objects (hl) with initially data members (nobl :13000, nob2:15 and nob3 :19), (kl) with initially data members (nobl:16000, nob2:77 and nob3:2018) and (TI) with initially data members (nobl:15000, nob2:37 and nob3:2020). Finally print the information of the object that has smallest nob2 for these three objects using void display friend function:

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter10: Classes And Data Abstraction
Section: Chapter Questions
Problem 16SA
icon
Related questions
Question
Q2) Write C++ code to create class called number. The private data members
for this class are nobl (double), nob2 (double) and nob3(double). The member
function for this class is:
1- (Constructor) that accepts nobl, nob2 and nob3 as arguments (inside
the class).
Write a main() that create two objects (hl) with initially data members (nobl
:13000, nob2:15 and nob3 :19), (kl) with initially data members (nobl:16000,
nob2:77 and nob3:2018) and (TI) with initially data members (nobl:15000,
nob2:37 and nob3:2020). Finally print the information of the object that has
smallest nob2 for these three objects using void display friend function:
Transcribed Image Text:Q2) Write C++ code to create class called number. The private data members for this class are nobl (double), nob2 (double) and nob3(double). The member function for this class is: 1- (Constructor) that accepts nobl, nob2 and nob3 as arguments (inside the class). Write a main() that create two objects (hl) with initially data members (nobl :13000, nob2:15 and nob3 :19), (kl) with initially data members (nobl:16000, nob2:77 and nob3:2018) and (TI) with initially data members (nobl:15000, nob2:37 and nob3:2020). Finally print the information of the object that has smallest nob2 for these three objects using void display friend function:
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
ADT and 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
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning