ScholarMatic | 24/7 Homework Help

ScholarMatic Will Help You Write Your Essays and Term Papers

Answered » You can buy a ready-made answer or pick a professional tutor to order an original one.

show a C++ program A4p2.cpp with a class of your own design.

by | Nov 28, 2023 | engineering

show a C++ program A4p2.cpp with a class of your own design. The class should contain a protected int member variable var, which is initialized with an integer value between 1 and 50 in a constructor that takes an integer parameter. The class should contain a public member function called play that should print out a sequence of integers as a result of iteratively applying a math function f to the member variable var. The function f is defined as f(x)=3x+1 if x is odd and f(x)=x/2 if x is even. Stop the iteration when the value 1 is reached. (Example: When var is 6, the play function’s output sequence should be 6,3,10,5,16,8,4,2,1.) In your main function show an object of this class whose member var should be initialized with the first command line argument to your program (i.e., argv[1]) and then call the play member function to output the corresponding sequence of integers. You can check whether the supplied first command line argument is an integer between 1 and 50 in your main function. A sample run can look like the following picture. Submit source code A4p2.cpp. No screen shot is needed.

ScholarMatic: Explanation & Answer

Your ready answer from a verified tutor is just a click away for as little as $14.99


  

Click Order Now to get 100% Original Answer Customized to your instructions!

HOME TO CERTIFIED WRITERS

Why Place An Order With Us?

  • Certified Editors
  • 24/7 Customer Support
  • Profesional Research
  • Easy to Use System Interface
  • Student Friendly Pricing

Have a similar question?

PLAGIRAISM FREE PAPERS

All papers we provide are well-researched, properly formatted and cited.

TOP QUALITY

All papers we provide are well-researched, properly formatted and cited.

HIGHLY SECURED

All papers we provide are well-researched, properly formatted and cited.

ScholarMatic: Get Started

Assignment Writing Service

Feel safe and secure when placing an order on our portal!
Fruitful cooperation begins with solid guarantees, and we are professional enough to promise perfect results. Let’s get it started!