Question: (35 pts) Write a C++ program A4p3.cpp with a class that is a derived class of your class from problem 2. Add a private int

  1. (35 pts) Write a C++ program A4p3.cpp with a class that is a derived class of your class from problem 2. Add a private intmember variable var2 to this class. Initialize the member variables var and var2 with values between 1 and 50 using a constructor that takes two integer parameters. Add a public member function called getsp that should print out the sum and product of var and var2. In your main function, create an object of this class, initialize its members var and var2 through constructor with the first two command line arguments to your program (i.e., argv[1] and argv[2]) and then call the play and getsp member functions on the object. A sample run can look like the following. Submit source code A4p3.cpp and you dont need to submit a screen shot. Please do NOT just submit A4p3.cpp because it seems to include all functionality of A4p2.cpp. You need to submit two separate program source files.

[kwang@computer][~/temp]$./A4p3 6 8

Iterated integer sequence for 6 is:

6 3 5 8 4 2 1

Length of the sequence: 7

Sum of 6 and 8 is 14. Product of 6 and 8 is 48.

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!