C++代写 COMP 2150 Assignment 2 Winter 2018代写C/C++实验作业

Introduction需要提交的文件:MyInteger.hpp MyInteger.cppIntegerSet.hpp IntegerSet.cppCOMP 2150 Assignment 2 Winter 2018Due:February 28th, 2018, before 11:59 pm.Notes• Please follow both the “Programming Standards” for all work you submit. Programming standards 1-25are in effect, but also follow all the specific requirements explained in this document. Marks will bededucted for not following the programming standards and the guidelines described in this document.• Any question about the assignment must be posted on the discussion forum on UMLearn, in the“Assignment 2” thread. Questions sent by email to the instructors will not be answered. You are alsoresponsible for reading the answers and clarifications posted in the discussion forum.• Hand-in will be via the D2L Dropbox facility. Make sure you leave enough time before the deadline toensure your hand-in works properly. The assignments are submitted using D2L’s time (not the time onyour computer). Assignments that are late will be marked according to the late policy in the ROASS.• Official test data will be provided several days before the assignment due date. Until then, work withyour own test data.• All assignments in this course carry an equal weight.Assignment 2: Event-Driven Simulation (supermarket) in C++DescriptionTo begin working in C++, you will write a program that will use a discrete-event simulation to simulatecustomers getting through the checkout lanes in a supermarket. You will implement two different typesof checkout systems:(1) Express Lane Simulation: a supermarket that has 1 express checkout lane (for 12 items or less)and one regular checkout lane  each customer that has 12 items or less will always go to theexpress lane and all the others will go to the regular lane;(2) One Waiting Line Simulation: a supermarket that has two checkout lanes (both for any numberof items) and only one waiting line  the next customer in the waiting line will go to the firstlane that is ready to serve a customer.Your program must use two command-line arguments: the first argument will be a filename (the filewill contain a list of arrival events - described below) and the second argument will be a flag (either 1 or2) which will determine which version of the supermarket to run (run like this for e.g.: a2.exe test.txt 1).You should be making use of all the facilities for doing OO in C++ that we have covered, includingappropriate use of abstract classes and methods, and safe dynamic casting. For example, the twodifferent versions of the supermarket simulation should be subclasses of an abstract class which wouldcontain all the code that is shared between the two subclasses.While you don’t have to completely follow OCCF standards, you must write destructors to properly freeany dynamically allocated memory that you use. You don’t need to worry about memory allocated inlinked structures that will exist until the end of the program, but anything that is unlinked or goes out ofscope during the course of the program’s run must be properly disposed of.COMP 2150 Assignment 2 Winter 2018Each class you define must separate the interface from the implementation. You do not need toseparately compile this program, but you can if you want to. You may also use the make utility if you arefamiliar with it, but again, there’s nothing forcing you to do that here.DetailsA data file is used to drive the simulation and will contain only arrival events. The data file will beordered by time, so you must have only one event read from the data file in the event queue at any time(you must not read the full file all at once). The processing of one arrival event must cause the nextevent to be read from the file. Each Customer will get an ID number (start at 1) when she arrives, andeach new Customer will have an ID one higher than the one before. You must use a C++ static variableto keep track of the next Customer number to be generated.There are three events that can happen in this system:An Arrival event occurs when a Customer arrives at the checkout lanes. This event will be handleddifferently depending on the type of simulation (1 or 2):(1) Express Lane Simulation: This Customer should be placed into the appropriate queue (regular orexpress, depending on the number of items; use a strict FCFS queuing discipline). If no Customeris currently ahead of this one in the queue, you should schedule a StartService event; otherwisethis Customer will have to wait her turn for service.(2) One Waiting Line Simulation: If the waiting line is empty and one of the checkout lanes is alsoempty, you should schedule a StartService event for the customer. Otherwise, this Customerwill have to wait her turn for service in the waiting line (once again, use a strict FCFS queuingdiscipline).Every time you process an Arrival event, you also must read the next event from the input file, if there isanother one, and add it to the event queue.A StartService event means the Customer is being served. The length of time it takes to serve thisCustomer depends on how many items are in the shopping cart and the types of the items. Theseservice times (corresponding to the time required to scan the items) are constant (see the table below),so it is possible to calculate how long a Customer’s service will take, given what is in the shopping cart.You must schedule a CompleteService event for that time (i.e., for the time the StartService began, plusthe time to complete the service).A CompleteService event occurs when the Customer’s service has been completed. The Customer willthen leave the supermarket. At this time, you should display a summary of the Customer’s service:which lane the Customer was in, the arrival time, the completion time, and how much time was spentwaiting in line. The checkout lane is now ready to serve the next customer: you must see if anotherCustomer is waiting for service, and schedule a StartService event for the next customer if there is one.You will need to maintain a list of future events in order by time (event queue). During the simulationprocess, at any point where the time unit is the same for two events, the Customer that arrived earliershould be handled first. This means that as the simulation goes on you will be maintaining a list ofpending events that is ordered by primarily by time, but within time, ordered by Customer number.As mentioned earlier, use a command-line argument to accept the name of the data file, and anotherargument to determine which version of the simulation to run (either 1 or 2). Your program should thenCOMP 2150 Assignment 2 Winter 2018open that file and perform. the simulation. This method will allow the markers to easily run your programon several different data files whose names you do not know ahead of time. Your program should writeto standard (console) output, not to an output file (again this makes things easy on the markers becausethey can just read output in a terminal window).Data file:The data file contains information on Arrival events only. Each event is on one line of the file. Each linebegins with a positive integer, which is the time of the arrival event. Next is the keyword ARRIVE,followed by one or more additional pairs of entries, representing this Customer’s shopping cart. Each pairconsists of a String (type of item) and a positive integer (how many are in the shopping cart). You canassume that there will be a maximum of one pair for each type of item (e.g. you will not see twice SMALLon one line), but the types of items will not always show up in the same order on the line (SMALL doesnot always come first for example). If an item type does not show up on the line, it’s because there is noitem of this type in the cart.This table lists the possible items that may be in the shopping cart, the amount of time needed to scanone of that item, and whether or not this type of item will count towards the total number of items (todetermine if the customer can go to the express lane):Item type Scan time (per item) Counts towards total nb ofitems (for express lane)SMALL 1 yesBIG 2 yesFORV (Fruit OR Vegetable) 4 yesCOUPON 5 noData StructuresYour data structures must be your own, and you cannot use the C++ standard template library: you mustmake generic data structures (for example, a Queue and a PriorityQueue would be useful) using yourown linked structures and making use of C++’s object-orientation features. In particular, you should havea polymorphic hierarchy of data items to go into generic data structures, and a polymorphic hierarchy ofEvents. IF YOU USE C++ ARRAYS, TEMPLATES OR STL DATA STRUCTURES, YOU WILL LOSE MARKS.Input and output example:Here is a simple example of an input data file:1 ARRIVE BIG 1221 ARRIVE SMALL 2 BIG 3 COUPON 136 ARRIVE FORV 2 BIG 438 ARRIVE BIG 1 SMALL 1453 ARRIVE BIG 55 SMALL 33 COUPON 3 FORV 1175 ARRIVE COUPON 2 FORV 5 BIG 2 SMALL 4124 ARRIVE BIG 3 SMALL 7 FORV 2 COUPON 10You should use this simple example to test your program before the official test data is uploaded onUMLearn (several days before the deadline).COMP 2150 Assignment 2 Winter 2018Your program should produce output that indicates the sequence of events processed and when theyoccurred in order by time. At the end of the simulation you will produce a simple summary of theservice, waiting and service times. The output of the above example is shown below, for the two typesof simulations.Output of Express Lane Simulation:Simulation begins…Time 1: Customer 1 arrives: BIG: 12 Service time: 24Time 1: Customer 1 begins service in Express laneTime 21: Customer 2 arrives: SMALL: 2 BIG: 3 COUPON: 1 Service time: 13Time 25: Customer 1 completes service in Express lane. Arrival: 1 Complete: 25 Wait: 0Time 25: Customer 2 begins service in Express laneTime 36: Customer 3 arrives: BIG: 4 FORV: 2 Service time: 16Time 38: Customer 2 completes service in Express lane. Arrival: 21 Complete: 38 Wait: 4Time 38: Customer 3 begins service in Express laneTime 38: Customer 4 arrives: SMALL: 14 BIG: 1 Service time: 16Time 38: Customer 4 begins service in Regular laneTime 53: Customer 5 arrives: SMALL: 33 BIG: 55 FORV: 11 COUPON: 3 Service time: 202Time 54: Customer 3 completes service in Express lane. Arrival: 36 Complete: 54 Wait: 2Time 54: Customer 4 completes service in Regular lane. Arrival: 38 Complete: 54 Wait: 0Time 54: Customer 5 begins service in Regular laneTime 75: Customer 6 arrives: SMALL: 4 BIG: 2 FORV: 5 COUPON: 2 Service time: 38Time 75: Customer 6 begins service in Express laneTime 113: Customer 6 completes service in Express lane. Arrival: 75 Complete: 113 Wait: 0Time 124: Customer 7 arrives: SMALL: 7 BIG: 3 FORV: 2 COUPON: 10 Service time: 71Time 124: Customer 7 begins service in Express laneTime 195: Customer 7 completes service in Express lane. Arrival: 124 Complete: 195 Wait: 0Time 256: Customer 5 completes service in Regular lane. Arrival: 53 Complete: 256 Wait: 1… simulation ended.###### Summary ######- Total number of customers: 7- Service time: total = 380, average = 54.2857- Waiting time: total = 7, average = 1Output of One Waiting Line Simulation:Simulation begins…Time 1: Customer 1 arrives: BIG: 12 Service time: 24Time 1: Customer 1 begins service in 1st laneTime 21: Customer 2 arrives: SMALL: 2 BIG: 3 COUPON: 1 Service time: 13Time 21: Customer 2 begins service in 2nd laneTime 25: Customer 1 completes service in 1st lane. Arrival: 1 Complete: 25 Wait: 0Time 34: Customer 2 completes service in 2nd lane. Arrival: 21 Complete: 34 Wait: 0Time 36: Customer 3 arrives: BIG: 4 FORV: 2 Service time: 16Time 36: Customer 3 begins service in 1st laneTime 38: Customer 4 arrives: SMALL: 14 BIG: 1 Service time: 16Time 38: Customer 4 begins service in 2nd laneTime 52: Customer 3 completes service in 1st lane. Arrival: 36 Complete: 52 Wait: 0Time 53: Customer 5 arrives: SMALL: 33 BIG: 55 FORV: 11 COUPON: 3 Service time: 202Time 53: Customer 5 begins service in 1st laneTime 54: Customer 4 completes service in 2nd lane. Arrival: 38 Complete: 54 Wait: 0Time 75: Customer 6 arrives: SMALL: 4 BIG: 2 FORV: 5 COUPON: 2 Service time: 38Time 75: Customer 6 begins service in 2nd laneTime 113: Customer 6 completes service in 2nd lane. Arrival: 75 Complete: 113 Wait: 0Time 124: Customer 7 arrives: SMALL: 7 BIG: 3 FORV: 2 COUPON: 10 Service time: 71Time 124: Customer 7 begins service in 2nd laneTime 195: Customer 7 completes service in 2nd lane. Arrival: 124 Complete: 195 Wait: 0Time 255: Customer 5 completes service in 1st lane. Arrival: 53 Complete: 255 Wait: 0… simulation ended.###### Summary ######- Total number of customers: 7- Service time: total = 380, average = 54.2857- Waiting time: total = 0, average = 0COMP 2150 Assignment 2 Winter 2018Hand-inSubmit all your source code for all classes. You should also submit three text documents:• The output of the official test data for the Express Lane Simulation.• The output of the official test data for the One Waiting Line Simulation.• Include a README.TXT file that describes exactly how to compile and run your code from thecommand line. The markers will be using these instructions exactly and if your code does not compiledirectly, you will lose marks.You MUST submit all of your files in a zip file on UMLearn.Remember: the easier it is to mark your assignment, the more marks you are likely to get. Do yourself afavour.本团队核心人员组成主要包括硅谷工程师、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 或邮箱:[email protected] 微信:codehelp

你可能感兴趣的:(C++代写 COMP 2150 Assignment 2 Winter 2018代写C/C++实验作业)