You are about to enter a place with calculating addition of three numbers. You need to complete the missing statements in Table 1, which can accomplish an output as shown in the figure below. class 1 class 2 class_3 IMPORTANT: Please write a C ++ statement WITHOUT ANY WHITE SPACE unless it is necessary. Example: float x-a+b; 1#include 2using namespace std; 3 4/|declare a class 5{ //access specifier 6 int cl; 7 public: 8 void setClass1(int nl){ 9 //assignment 10 cout<<"Number 1 = "<

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
100%

C++

You are about to enter a place with calculating addition of three numbers.
You need to complete the missing statements in Table 1, which can accomplish an output as
shown in the figure below.
class 1
class 2
class 3
IMPORTANT:
Please write a C ++ statement WITHOUT ANY WHITE SPACE unless it is necessary.
Example: float x=q+b;
1#include <iostream>
2using namespace std;
3
4/|declare a class
5{ //access specifier
6 int cl;
7 public:
8 void setClass1(int nl){
//assignment
10
cout<<"Number 1 = "<<cl<<endl;
11 }
12 int getDatal(){ return cl; }
13};
14
15//declare a class
16 {//access specifier
17 int c2;
18 public:
19 void setClass2(int n2){
20
//assignment
21
cout<<"Number 2 = "<<c2<<endl;
22 }
23 int getData2(){ return c2; }
24};
25
26//declare a class
27 {//access specifier
28 int c3;
29 public:
30 void setClass3(int n3){
31
//assignment
32
cout<<"Number 3 = "<<c3<<endl;
33 }
34 int getData3(){ return c3; }
35
void display(){cout<<"Number 1 + Number 2 - Number 3 = "<«cl+c2-c3; }
36};
37
38int main(){
39 ||declare object for the class
40 number.setClass1(1);
41 number.setClass2(2);
42 number.setClass3(3);
43 ||call the display function
44 return 0;
45}
Line Missing Statements
|4
15
19
15
16
20
26
27
31
39
43
What is the concept applied in Program 1?
Which class is the base class in Program 1?
Transcribed Image Text:You are about to enter a place with calculating addition of three numbers. You need to complete the missing statements in Table 1, which can accomplish an output as shown in the figure below. class 1 class 2 class 3 IMPORTANT: Please write a C ++ statement WITHOUT ANY WHITE SPACE unless it is necessary. Example: float x=q+b; 1#include <iostream> 2using namespace std; 3 4/|declare a class 5{ //access specifier 6 int cl; 7 public: 8 void setClass1(int nl){ //assignment 10 cout<<"Number 1 = "<<cl<<endl; 11 } 12 int getDatal(){ return cl; } 13}; 14 15//declare a class 16 {//access specifier 17 int c2; 18 public: 19 void setClass2(int n2){ 20 //assignment 21 cout<<"Number 2 = "<<c2<<endl; 22 } 23 int getData2(){ return c2; } 24}; 25 26//declare a class 27 {//access specifier 28 int c3; 29 public: 30 void setClass3(int n3){ 31 //assignment 32 cout<<"Number 3 = "<<c3<<endl; 33 } 34 int getData3(){ return c3; } 35 void display(){cout<<"Number 1 + Number 2 - Number 3 = "<«cl+c2-c3; } 36}; 37 38int main(){ 39 ||declare object for the class 40 number.setClass1(1); 41 number.setClass2(2); 42 number.setClass3(3); 43 ||call the display function 44 return 0; 45} Line Missing Statements |4 15 19 15 16 20 26 27 31 39 43 What is the concept applied in Program 1? Which class is the base class in Program 1?
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
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.
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