1 #include 2 3- class Full_Date { 4 public: int m = 1; int d = 1; int y = 1; Full_Date() { y = 2000; 5 6 7 8 9- 10 11 } 12- 13 14 15 16 } 17 18 19 20 21 }; 22 Full Date(int mon, int day) { m = mon; d = day; y = 2020; int getM() const { return m; } int getD() const { return d; } int getY() const { return y; } void sety(int yr) { y = yr; } 23 int main() 24-{ 25 26 27 22228 29 30 } Full Date d1(3,14); Full Date d2; d1.setY(2012); " "1 std::cout << d1.getY() << and << d2.getY() << std::endl; return 0;
1 #include 2 3- class Full_Date { 4 public: int m = 1; int d = 1; int y = 1; Full_Date() { y = 2000; 5 6 7 8 9- 10 11 } 12- 13 14 15 16 } 17 18 19 20 21 }; 22 Full Date(int mon, int day) { m = mon; d = day; y = 2020; int getM() const { return m; } int getD() const { return d; } int getY() const { return y; } void sety(int yr) { y = yr; } 23 int main() 24-{ 25 26 27 22228 29 30 } Full Date d1(3,14); Full Date d2; d1.setY(2012); " "1 std::cout << d1.getY() << and << d2.getY() << std::endl; return 0;
Chapter3: Data Representation
Section: Chapter Questions
Problem 30VE: A(n) ____________ is one instance or variable of a class.
Related questions
Question
A. What will be printed executing the code above?
B. What is the simplest way to set a variable of the class Full_Date to January 26 2020?
C. Are there any empty constructors in this class Full_Date?
a. If there is(are) in which code line(s)?
b. If there is not, how would an empty constructor be? (create the code lines for it)
D. Can the command std::cout << d1.m << std::endl; be included after line 28 without
causing an error?
a. If it can, what will be printed?
b. If it cannot, how could this command be fixed?

Transcribed Image Text:1 #include <iostream>
2
3- class Full_Date {
4
public:
int m = 1;
int d = 1;
int y = 1;
Full_Date() {
y = 2000;
5
6
7
8
9-
10
11
}
12-
13
14
15
16
}
17
18
19
20
21 };
22
Full Date(int mon, int day) {
m = mon;
d = day;
y = 2020;
int getM() const { return m; }
int getD() const { return d; }
int getY() const { return y; }
void sety(int yr) { y = yr; }
23 int main()
24-{
25
26
27
22228
29
30 }
Full Date d1(3,14);
Full Date d2;
d1.setY(2012);
"
"1
std::cout << d1.getY() << and << d2.getY() << std::endl;
return 0;
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps

Recommended textbooks for you

Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning

Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning

Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning

Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning

C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage