Question: c++ QUESTION 16 1. Order the code for the class. Put the private section before the public section. a)}; b)Person() { name=; middle_initial=' '; birth_year=1990;

c++

c++ QUESTION 16 1. Order the code for the class. Put the

QUESTION 16

1. Order the code for the class. Put the private section before the public section.

a)};

b)Person() {

name="";

middle_initial=' ';

birth_year=1990;

}

c) class Person {

d) private:

e) string name;

char middle_initial;

int birth_year;

f) public:

QUESTION 17

1. Select all the things that are the SAME for both a struct and a class.

a) can have setters and getters

b) can have constructors and destructors

c) by convention, the name is capitalized

d) is a programmer-defined data type

e) can use dot notation to access members

QUESTION 18

1. What code will initialize an array with even-numbered elements set to 4.99 and the odd-numbered elements set to 7.99? (Elements are numbered at offsets 0, 1, 2, ...)

a) array[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24] = 4.99;

array[1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25] = 7.99;

b) for (int i=1; i

if (i % 2) array[i] = 7.99;

else array[i] = 4.99;

}

c) for (int i=0; i

array[i] = 4.99;

array[i+1] = 7.99;

}

d) for (int i=0; i

if (i % 2) array[i] = 4.99;

else array[i] = 7.99;

}

e) for (int i=0; i

if (i % 2) array[i] = 7.99;

else array[i] = 4.99;

}

QUESTION 20

1. Below is C++ code that defines an array and loads it with some data. Select the C++ code equivalent(s) necessary for doing this with a vector.

char vowels[5];

vowels[0]='a';

vowels[1]='e';

vowels[2]='i';

vowels[3]='o';

vowels[4]='u';

a) vector vowels {" aeiou"};

b) vector vowels[5];

vowels[0]='a';

vowels[1]='e';

vowels[2]='i';

vowels[3]='o';

vowels[4]='u';

c) vector vowels {"aeiou"};

e) #include

f) vector vowels {'a', 'e', 'i', 'o', 'u'};

QUESTION 18 QUESTION 16 Orderthe code for the class. Put the private section before the public section. L. What code will initialize an array with even-numbered elements set to 4.99 and the odd-numbered 1. elements set to 7.997 (Elements are numbered at offsets 0, 1, 2, array0. 2. 4,6.8. 10. 12. 14. 16. 18. 20. 22.24]-4.99: array[1.3. 5.7.9,11. 13.15. 17. 19. 21. 23.25]7.99: for (int i-1: is-25:+) ( else array[i] 4.99: for (inti-o is25; ++i) { arTayli 1]-7.99: if (i % 2) array [i-7.99: Person name- C bith vea 1990: rTay]-4.99: for int i-0: i25;+ if (i % 2) array [i]-4.99: else array[i] = 7.99: class Person for (int i:0 25:-+D { if a 96 2) array [i]-7.99: else array[4.99: private: QUESTION 20 Below is C++ code that defines an array and loads it with some data. Select the C+code equivalent(s) necessary for doing this with a vector char vowels[5) vowelsl'a vowels[1]-e vowels[2]- vowels[3-o vowels[4]-u': 1. sting nane: int birth rear public: vector vowelsestring> {'aeiou"): vector vowels[5]: vowelsf01'a vowels[1]Fe vowels[2]F vowels[3-o vowels[4]-u': QUESTION 17 1. Select all the things that are the SAME for both a struct and a class. can have setters and getters can have constiructors and destructors by convention, the name is capitalized is a programmer-defined data type r vectorcstring vowels (aeiou) can use dot notation to access members #include vectorcehar> vowels fa,' 'e, '. 'o', 'u')

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!