辅导data structure、 写作Python编程、Java,c++程序 辅导

” 辅导data structure、 写作Python编程、Java,c++程序 辅导Part 1 Delayed Stack (8%)A stack is a data structure where the element removed is always the most recently added out of theremaining elements. See: Stack (abstract data type) – Wikipedia. The two main operations are push(E)which adds an element and pop() which removes an element.A DelayedStack works like a normal stack except has a restriction (delay condition) that prohibitselements from being removed until a certain number of push operations have occurred. Once therequired number of push operations occur, any number of elements may be removed, however themoment another element is added, the Delay condition comes back into force.Your task is to create a class called MyStack that implements the generic DelayedStack interface accordingto the specification written in the docstrings for each method. Your class should be able to be instantiatedwithDelayedStack… s = new MyStack…(9);where the … can be replaced by any object, and the int parameter for the constructor represents the maxdelay value (ie. number of push operations that must occur before pop operations can start to occur).If the max delay value is changed, the change does not take effect until the next time the delay is reset tothe maximum (ie. when push occurs after a sequence of pop operations).For this task you may not import anything from the java standard library, or external libraries.Page 2 of 6Examples (1)DelayedStackString s = new MyStackString(4); //delay condition of 4s.push(first element);s.push(something else);s.pop(); //return value is null, Because so far only 2 elements havebeen pusheds.push(third);s.push(fourth);s.pop(); //return value is fourths.push(another one);s.pop() //return value is null again, because the delay condition hasbeen resets.push(2);s.push(3);s.push(4);s.pop(); // return value is 4s.pop(); // return value is 3s.pop(); s.pop(); s.pop(); s.pop();//return values are 2, another one, third, something elseExamples (2)DelayedStackString s = new MyStackString(0); //delay condition of 0means that there is never a restriction. Same with negative values, or1.s.push(hello);s.pop(); //returns hellos.setMaximumDelay(2);s.getMaximumDelay(); //return value is 2s.pop(); //IllegalStateException is thrown, the stack is emptys.push(X);s.push(a);s.push(b);s.push(c);s.pop(); //return value is cs.pop(); //return value is bs.setMaximumDelay(4);s.getDelay(); //return value is 0.s.pop(); //return value is a delay is not set until the next pushs.push(Y); s.push(Z);s.setMaximumDelay(-1);s.getDelay(); //return value is 2 Delay is not set yets.push(An);s.getDelay(); //return value is 1s.pop(); //return value is nulls.push(AX);s.getDelay(); //return value is 0s.pop(); //return value is AXPage 3 of 6Part 2 Delayed Queue (8%)A queue is a data structure where the element removed is always the oldest element (the one which hasbeen waiting the longest) out of the remaining elements, ie. the one which was added the least recently.See: Queue (abstract data type) – Wikipedia. The two main operations are enqueue(E) which adds anelement and dequeue() which removes an element.A DelayedQueue works like a normal queue except has a restriction (delay condition) that prohibitselements from being removed until a certain number of enqueue operations have occurred. Once therequired number of enqueue operations occur, any number of elements may be removed, however themoment another element is Added, the delay condition comes back into force.Your task is to create a class called MyQueue that implements the generic DelayedQueue interfaceaccording to the specification written in the docstrings for each method. Your class should be able to beinstantiated withDelayedQueue… s = new MyQueue…(7);where the … can be replaced by any object, and the int parameter for the constructor represents the maxdelay value (ie. number of enqueue operations that must occur before dequeue operations can start tooccur).If the max delay value is changed, the change does not take effect until the next time the delay is reset tothe maximum (ie. when enqueue occurs after a sequence of dequeue operations).For this task you may not import anything from the java standard library, or external libraries.Page 4 of 6Examples (1)DelayedQueueString s = new MyQueueString(4); //delay condition of 4s.enqueue(first element);s.enqueue(something else);s.dequeue(); //return value is null, because so far only 2 elementshave been pusheds.enqueue(third);s.enqueue(fourth);s.dequeue(); //return value is first elements.enqueue(another one);s.dequeue() //return value is null again, because the delay conditionhas been resets.enqueue(2);s.enqueue(3);s.enqueue(4);s.dequeue(); // return Value is something elses.dequeue(); // return value is thirds.dequeue(); s.dequeue(); s.dequeue(); s.dequeue();//return values are fourth, another one, 2, 3Examples (2)DelayedQueueString s = new MyQueueString(0); //delay condition of 0means that there is never a restriction. Same with negative values, or1.s.enqueue(hello);s.dequeue(); //returns hellos.setMaximumDelay(2);s.getMaximumDelay(); //return value is 2s.dequeue(); //IllegalStateException is thrown, the queue isemptys.enqueue(X);s.enqueue(a);s.enqueue(b);s.enqueue(c);s.dequeue(); //return value is Xs.dequeue(); //return Value is as.setMaximumDelay(4);s.getDelay(); //return value is 0.s.dequeue(); //return value is b delay is not set until the nextpushs.enqueue(Y); s.enqueue(Z);s.setMaximumDelay(-1);s.getDelay(); //return value is 2 delay is not set yets.enqueue(An);s.getDelay(); //return value is 1s.dequeue(); //return value is nulls.enqueue(AX);s.getDelay(); //return value is 0s.dequeue(); //return value is cPage 5 of 6Writing your own testcasesWe have provided you with some test cases but these do not test all the functionality described in theassignment. It is important that you thoroughly test your code by writing your own test cases.For this assignment, you must write JUnit tests. You should place all of your test cases within two files:MyStackTest.java and MyQueueTest.java, each within their respective components of the assignment.Ensure that your tests can be run with JUnit as demonstrated in the lectures and tutorials.Submission DetailsYou must submit your code and tests using the assignment page on Ed. To submit, simply place your filesand folders into the workspace, click run to check your program works and then click submit.You are encouraged to submit Multiple times, but only your last submission will be considered.Marking 10 marks will be assigned based on the results of the automatic tests and correctness of theprogram (5 marks for part 1 and 5 marks for part 2). This component will use hidden test casesthat cover every aspect of the specification. Your program must match the exact output in theexamples and the test cases on Ed. 5 marks will be assigned to the code coverage of the testcases you have written yourself (2.5marks for part 1 and 2.5 marks for part 2). For this, we will use a script to automatically generatea code coverage report using Jacoco. For this reason, please make sure you structure yourtestcases in the manner described above. 1 mark will be assigned for a manual check of your code style. Your code style should follow theGoogle Java Style Guildeline. This includes things like appropriate indentation, vertical spacingbetween functions and logical sections of code and horizontal spacing between conditionalstatements and variable declarations. It will also cover adherence to OO design principles.Page 6 of 6Academic DeclarationBy submitting this assignment you declare the following:I declare that I have read and Understood the University of Sydney Student Plagiarism: Coursework Policyand Procedure, and except where specifically acknowledged, the work contained in thisassignment/project is my own work, and has not been copied from other sources or been previouslysubmitted for award or assessment.I understand that failure to comply with the Student Plagiarism: Coursework Policy and Procedure can leadto severe penalties as outlined under Chapter 8 of the University of Sydney By-Law 1999 (as amended).These penalties may be imposed in cases where any significant portion of my submitted work has beencopied without proper acknowledgment from other sources, including published works, the Internet,existing programs, the work of other students, or work previously submitted for other awards orassessments.I realise that I may be asked to identify those portions of the work contributed by me and required todemonstrate my knowledge of the relevant material by answering oral questions or by undertakingsupplementary work, either written Or in the laboratory, in order to arrive at the final assessment mark.I acknowledge that the School of Computer Science, in assessing this assignment, may reproduce itentirely, may provide a copy to another member of faculty, and/or communicate a copy of this assignmentto a plagiarism checking Service or in-house computer program, and that a copy of the assignment may bemaintained by the service or the School of Computer Science for the purpose of future plagiarism checking. https://www.6daixie.com/contents/3/6209.html

添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导