美文网首页
C++代写 Write a class called Inte

C++代写 Write a class called Inte

作者: kggtz00 | 来源:发表于2019-03-03 15:39 被阅读0次

    Introduction需要提交的文件:MyInteger.hpp MyInteger.cppIntegerSet.hpp IntegerSet.cppWrite a class called IntegerSet, which represents a mathematicalset of integer values. The IntegerSet will store the values in anarray, which will need to grow if it gets full. IntegerSet shouldhave the following data members:• an int-pointer that points to a dynamically allocated array (ofint) that holds the values that are part of the set• an int that holds the current size of the array - it will need tobe updated whenever the add() method creates a largerarray• an int that holds the number of values that are currently partof the set - it will need to be updated in the add() andremove() methodsThe IntegerSet class should have the following methods:• a default constructor that initializes the pointer data memberto point to an array of size 10, initializes the variable thatstores the size of the array to 10, and initializes the variablethat stores the number of values in the set to zero• a copy constructor that initializes the pointer data memberto point to an array of the same size as the one beingcopied, copies over the array values, and also copies thevalues for the size of the array and the number of values inthe set• an overloaded assignment operator that initializes thepointer data member to point to an array of the same sizeas the one being copied, copies over the array values,copies the values for the size of the array and the number ofvalues in the set, and returns a reference to the objectpointed to by the this pointer• a destructor that deallocates the dynamically allocated array• the size() method should return the number of valuescurrently in the IntegerSet• the isEmpty() method should return true if the IntegerSetcontains no values, and return false otherwise• the contains() method should take an int parameter andreturn true if that value is in the IntegerSet, but return falseotherwise• the add() method should take an int parameter and add thatvalue to the IntegerSet (if that value is not already in theIntegerSet) - if the array is currently full and you need to addanother value, then you must first increase the size of thearray by allocating a new array that is twice as large,copying the contents of the old array into the new array,redirecting the data member pointer to the new array, anddeallocating the old array (avoid memory leaks - ordermatters)• the remove() method should take an int parameter andremove it from the IntegerSet (if that value is in theIntegerSet) by shifting over all of the subsequent elementsof the array - it’s okay if values that are no longer part of theset are still in the array, so long as you do the rightbookkeeping• the getAsVector method should return a vector (of ints) thatcontains all of the values in the IntegerSet and only thosevalues. Order doesn’t matter.• an overloaded + operator that returns a new IntegerSet thatis the union of its two operands (contains all and only thosevalues that were in either IntegerSet)• an overloaded operator that returns a new IntegerSet thatis the intersection of its two operands (contains all and onlythose values that were in both IntegerSets)• an overloaded / operator that returns a new IntegerSet thatis the symmetric difference of its two operands (contains alland only those values that were in one IntegerSet or theother, but not both)One short example of how the IntegerSet class could be used:IntegerSet mySet1;mySet1.add(-30);mySet1.add(13);mySet1.add(100);mySet1.remove(-30);mySet1.add(44);int size = mySet1.size();IntegerSet mySet2 = mySet;bool check1 = mySet2.contains(13);bool check2 = mySet2.contains(44);IntegerSet mySet3 = mySet1 mySet2;The files must be named: IntegerSet.hpp and IntegerSet.cpp本团队核心人员组成主要包括硅谷工程师、BAT一线工程师,精通德英语!我们主要业务范围是代做编程大作业、课程设计等等。我们的方向领域:window编程 数值算法 AI人工智能 金融统计 计量分析 大数据 网络编程 WEB编程 通讯编程 游戏编程多媒体linux 外挂编程 程序API图像处理 嵌入式/单片机 数据库编程 控制台 进程与线程 网络安全 汇编语言 硬件编程 软件设计 工程标准规等。其中代写编程、代写程序、代写留学生程序作业语言或工具包括但不限于以下范围:C/C++/C#代写Java代写IT代写Python代写辅导编程作业Matlab代写Haskell代写Processing代写Linux环境搭建Rust代写Data Structure Assginment 数据结构代写MIPS代写Machine Learning 作业 代写Oracle/SQL/PostgreSQL/Pig 数据库代写/代做/辅导Web开发、网站开发、网站作业ASP.NET网站开发Finance Insurace Statistics统计、回归、迭代Prolog代写Computer Computational method代做因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com 微信:codehelp

    相关文章

      网友评论

          本文标题:C++代写 Write a class called Inte

          本文链接:https://www.haomeiwen.com/subject/fczpuqtx.html