美文网首页
C代写 HW4 Shapes W2017代做C/C++课程设计

C代写 HW4 Shapes W2017代做C/C++课程设计

作者: xsc5773 | 来源:发表于2019-04-26 16:55 被阅读0次

    Introduction部分代码示例:#ifndef COLLECTION_H#define COLLECTION_H#include#include”Shape.h”#include”Square.h”#include”Diamond.h”using namespace std;class Collection{private:int lowest_X; //rangeint lowest_Y;int highest_X;int highest_Y;vector Shape_List; //the list of shapespublic:Collection(int _lx,int _hx,int _ly,int _hy);void addShape(Shape tmp);void display();int totalStars();void moveBy(int _x,int _y);void setSize(int _size);};#endif注:提交时只要提交Collection.cpp Collection.h Diamond.h Diamond.cpp Shape.cpp Shape.h Square.cpp Square.hRequirementHW4_Shapes_W2017PIC 10B Section 1 - Homework # 4 (due Friday, February 10, by 9 am)You should upload each .cpp and .h file separately and submit them toCCLE before the due date/time! Your work will otherwise not be consideredfor grading. Do not submit a zipped up folder or any other type of file besides.h and .cpp.Be sure you upload files with the precise name requested of you and that itmatches the names you used in your editor environment otherwise there maybe linker and other errors when your homeworks are compiled on a differentmachine. Also be sure your code compiles and runs on Visual Studio 2015.LOW BUDGET GRAPHICSIn this homework, you’ll get to work with polymorphism and apply it to some very low-budget graphics. The implementation that you choose is somewhat up to you provided itconforms to the functionality described below. In the end, you will submit 4 or 5 files:Collection.h, Shape.h, Square.h, and Diamond.h. You can also upload a .cppfile with the implementations of these classes separately or implement the classes withinthe header files.Conventions: this problem is about plotting a Collection of Shapes. Each shape ismade up of a discrete set of points at specific x- and y-values. A Collection will onlydisplay and count the points corresponding to Shapes it stores that are within its x- andy-ranges. The x-positions increase as we move right (increase in column number); andthe y-positions increase as we move down (increase in row number).Okay, now that we’ve established this, let’s consider the classes. The following is thebare minimum necessary for you to understand what is required, but you may need toadd further functions, specifications, or variables than those specified.1The Collection class should• have a constructor accepting 4 int inputs that respectively denote the lowest x-position, the highest x-position, the lowest y-position, and the highest y-positionover which the class should display in its window;• have an addShape function that when provided with a Shape object, adds it tothe collection;• have a display function to display its shapes only on the appropriate range of x- andy-values, from the lowest to highest values inclusive, printing ‘*’ if there is a shapepoint present and ‘-’ if there is no shape point present; following this, it should listthe shape types, in order, within the vector, and this function must make useof dynamic cast;• have a totalStars function to return the total number of stars that are within theplot range;• have a moveBy function taking two arguments, the first describing how much tomove all shapes in the x-direction and the second describing how much to move allshapes in the y-direction; and• have a setSize function taking a single argument and setting the size property ofall shapes.The Shape class should:• have a constructor accepting three parameters that respectively denote the shape’sx- and y-position and size;• have a purely virtual function setStars that resets the values of the coordinatesstoring a shapes location should it be moved or resized;• have a moveBy function accepting two int inputs that respectively denote howmuch to move the shape’s centre in the x- and y-directions, respectively, and whichinvokes setStars; and• have a setSize function accepting an input for the new size parameter that invokessetStars afterwards.The Square class should:• have a constructor accepting three parameters: the first two representing its x- andy-position (and for the square this denotes its top left position) and the third repre-senting its size (and for the square this is the number of stars for its height/width).The Diamond class should:• have a constructor accepting three parameters: the first two representing its x- andy-position (and for the diamond this denotes its centre) and the third representingits size (and for the diamond this is the number of stars from its centre point to itstop inclusive).Note that the Diamond class looks like a diamond and it is symmetric about itscentreline (see the output figure).An example set of code and output are given below: your actual homework will begraded against a different .cpp file. Do not submit a main routine!You may assume the user will only enter valid parameters and use the function namesconsistent with this homework.Note below that only stars that are with an x-position from 0 to 10 inclusive and ay-position from 0 to 10 inclusive are plotted. That’s why sp3, which overlaps a little withsp1, only appears as 3x3, not 4x4.Hints:• You may wish to include helper member function in Collection that returns a bool,true if there is a star present and otherwise false, when given an x- and y-position.• Although not required, you may wish to use the template class std::pair, whichis found in the header. Look this up, if you haven’t seen pairs before;it’s easy to use, and a std::vector of them could be useful, depending on yourimplementation.本团队核心人员组成主要包括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代写 HW4 Shapes W2017代做C/C++课程设计

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