Question
#ifndef TEST_H #define TEST_H #include using namespace::std; class Test { private: int codigo; double x1; public: Test(int); void set(int, double); void showVal(); }; #endif #include
#ifndef TEST_H #define TEST_H #include
class Test {
private: int codigo; double x1;
public: Test(int); void set(int, double); void showVal();
};
#endif
#include
#include "Test.h"
Test::Test(int c) { codigo = c; x1 = 0.0; cout << c; }
void Test::set(int c, double x_par) { if (c > 0) codigo = c; else codigo = 1111;
x1 = x_par; }
void Test::showVal() { cout << x1;
}
With this code, answer the following questions in the main function:
#include
#include "Test.h"
/*Question 1: This program from the class Test, prints the following:*/ _______________
int main() {
Test t1(1212); cout << " "; return 0; }
/*Part 2: If to the class Test you add the two following intructions:*/ t1.set(3000, 1.99); cout << " "; t1.showVal(); cout << " ";
/*Question 2: What prints when you execute the following instruction, after the two intructions from before?*/ t1.showVal();
______________ /*Part 3: If to the class Test, you also add the following instruction:*/ t1.set(-4444, -7.99);
/*Questions 3 and 4: What value is stored in object t1 now in:*/ Question 3: codigo: value stored is: ________
Question 4: x1: value stored is: ________
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started