Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 2: PART A: #include #include #include using namespace std; class Student { public: Student(); Student(string studentName); Student(string studentName, int studentAge, double studentHeight); void Print();

QUESTION 2:

PART A:

image text in transcribed

#include #include #include using namespace std;

class Student { public: Student(); Student(string studentName); Student(string studentName, int studentAge, double studentHeight); void Print(); private: string name; int age; double height; };

Student::Student() { name = "NoName"; age = 0; height = 0.0; }

Student::Student(string studentName) { name = studentName; age = 0; height = 0.0; }

Student::Student(string studentName, int studentAge, double studentHeight) { name = studentName; age = studentAge; height = studentHeight; }

void Student::Print() { cout

int main() { string studentName; int studentAge; double studentHeight; cin >> studentName; cin >> studentAge; cin >> studentHeight;

// ENTER THE MISSING PIECE OF CODE HERE AND TEST IT IN C++ (THANK YOU)

student1.Print(); student2.Print(); student3.Print(); return 0; }

PART B:

image text in transcribed

#include #include using namespace std;

int main() { int numValues; unsigned int i; vector febFeaturedItems; vector decFeaturedItems; vector decBackup; cin >> numValues; febFeaturedItems.resize(numValues); decFeaturedItems.resize(numValues); cout > febFeaturedItems.at(i); cout > decFeaturedItems.at(i); cout

// ENTER THE MISSING PIECE OF CODE HERE AND TEST IT IN C++ (THANK YOU)

if (decBackup.size() > 0) { cout

PART C:

image text in transcribed

#include #include using namespace std;

int main() { vector valElements(2); int initValues = 2; unsigned int i; int listSize; int startNum;

valElements.at(0) = 16; valElements.at(1) = 36;

cin >> listSize; cin >> startNum;

// ENTER THE MISSING PIECE OF CODE HERE AND TEST IT IN C++ (THANK YOU)

for (i = 0; i

return 0; }

-----------

Thank you >:O

The Student class has a default constructor, a constructor with one parameter, and a constructor with three parameters. Declare the following objects: - student1 with no arguments - student2 with studentName as an argument - student3 with studentName, studentAge, and studentHeight as arguments Ex: If the input is Ada 204.75, then the output is: Student: NoName, 0,0.00 Student: Ada, 0,0.00 Student: Ada, 20,4.75 Integer numValues is read from input. Then, numValues strings are read and stored in vector febFeaturedltems, and numValues strings are read and stored in vector decFeaturedltems. Perform the following tasks: - If febFeaturedltems is equal to decFeaturedltems, output "February's featured items are the same as December's featured items." - Otherwise: - Output "February's featured items are not the same as December's featured items." - Assign decBackup as a copy of decFeatureditems. Ex: If the input is 2 salmon aqua brown indigo, then the output is: February's featured items: salmon aqua December's featured items: brown indigo February's featured items are not the same as December's featured items. December's backup: brown indigo Given an integer vector valElements with two elements and input integers listSize and startNum, resize valElements to listSize. Then, assign the new elements of valElements with startNum 3i, where i is the index of each element in the vector. Ex: If the input is 421 , then the output is: 16361512

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial and Managerial Accounting

Authors: Horngren, Harrison, Oliver

3rd Edition

978-0132497992, 132913771, 132497972, 132497999, 9780132913775, 978-0132497978

Students also viewed these Databases questions