Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using Microsoft Visual Studio create a C++ program that solves the following pro

ID: 3691085 • Letter: U

Question

Using Microsoft Visual Studio create a C++ program that solves the following problem.

1. Read the problem. Create a project that includes a class definition, an object of that class type, and passes a value from the object to the main program. Your program must contain the following attributes:
a. A class named HoldValueClass and a derived object named HoldValueObject. b. The class should include a member that holds the string your name. c. The class should include a method that returns the string. d. The main code module should include only a main() function. The main() function should include only the object creation, a call to the class method that returns the string, and a command to display the string on the console. 2. Create a new project. Visual C++ Win32 Console Application Select a location where you can find it later Choose the default application settings 3. Write the program. Write code that solves the problem described in item 1. Pause the program so that the console does not disappear until a key is pressed. 4. Insure that you properly document your code.

Explanation / Answer

#include<iostream>

using namespace std;

// class Defination
class HoldValueClass{
   // member of class
   string name; // holds name
   public:
       // constructor that takes a string as parameter
       HoldValueClass(string n){
           name = n; // setting parameter to member variable
       }
       // method that returns string value
       string getName(){
           return name;
       }
};


// main method

int main(){
  
   // creating a object of type HoldValueClass, with name "Alex Bob"
   HoldValueClass HoldValueObject("Alex Bob");
  
   // printg name
   cout<<"Name: "<<HoldValueObject.getName()<<endl;
  
   return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote