代写C++代码 代做C++程序 C++辅导 C++教学

C++网络家教 远程写代码 在线Debug 讲解答疑 不是中介,本人直接写

微信: ittutor QQ: 14061936 Email: ittutor@qq.com

导航


For this project, you will create a program that asks the user to enter a positive integer value less than 20.  


If the user enters a number greater than 20, the user should get an error.


If the user enters a number equal to or less than 20, display the double of each value beginning with 1 up to the selected number (multiply each number by 2), then provide the total of all doubles.  


For example, if the user entered the number 5, the following should display:


Double up 1 = 2


Double up 2 = 4


Double up 3 = 6


Double up 4 = 8


Double up 5 = 10


Total = 30


You will be using mutator and accessor functions.  A mutator function is simply a fancy name for a function that modifies private data.  An accessor function is a function which has the sole purpose of providing access to private data.


Minimum Requirements:


•Create a class that has 3 public functions. 

1.A mutator function should take the number from the user and store it in a private variable. (5 points)

2.Another function should perform the calculations, display the double up results and store the total in a private variable. This function must use a loop. (5 points)

3.An accessor function should display the total. (5 points)

•Create a main function that creates an object of your class and calls each of the functions of the class. (5 points)


相关推荐