Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Inheritance Lab | CS 159 CS 159 Docs Labs Projects Labs 01 - Eclipse Lab 02 - Memory Lab 03 - Two-Dimensional Arrays Lab 04 - Debugger Lab 05 - Class Design Lab 06 - ArrayList Lab 07 - File I/O Lab 08 - Unit Testing Lab 09 - Inheritance I/O Lab 13 - Exam 2 Practice Lab 14 - Object-Oriented Design Lab Class Design Tips 15 - Interfaces Lab 16 - Collections Lab View page source Edit this page Create child page Create documentation issue Print entire section Inheritance in Bob’s Grocery Mart Introduction Instructions Tag Cloud .equals1 .jar1 .toString1 2D-array2 abstract1 accessor1 activation record1 arguments1 array3 arraylist1 checkstyle2 class design1 CLI3 collections1 command line3 constructor1 coverage1 data modeling1 debugger1 design1 docs1 document3 eclipse3 editor3 enum1 exam21 exceptions1 file3 format2 generalization1 gradescope1 heap1 inheritance3 input2 install1 interface1 jacoco1 jdk1 junit5 lab1 load1 memory1 mutator1 object-oriented1 oo1 OOP1 output2 overload1 override2 polymorphism2 project7 project11 project21 project31 project41 project51 project61 read1 recursion1 save1 setup1 stack1 stub1 test2 tutor1 UML1 unit test3 unit testing1 validate1 visualizer1 write1 Categories Docs2 Lab15 Project7 Labs 09 - Inheritance I/O Lab Inheritance Lab Tags: inheritance Categories: Lab   3 minute read   Inheritance in Bob’s Grocery Mart Introduction The Bob's Grocery Mart Simulator has been a big success. Cashiers are being scheduled more efficiently, and profits are up. However, Bob is concerned that some important factors are not captured by the current program. In particular, the simulation allows checkout lines to grow arbitrarily long. Beyond a certain length, real customers would choose to leave the store rather than waiting. Your goal for this assignment is to modify the simulation so that customers will refuse to enter a checkout line if that line has reached some maximum capacity. Instructions Download the following files: Aisle.java Customer.java MartSimulation.java MartDriver.java Take a few minutes to look over the existing classes to get a feel for how they work. Try executing MartDriver several times to see what the output looks like. What is the average wait time with 12 cashiers? What is the average wait time with 6 cashiers? Create a new class that extends Aisle. As always, you should think carefully about what to name your class. One common convention in naming subclasses is to prefix the superclass name with an adjective the clarifies how the subclass specializes the superclass. For example, the Car class might have a subclass named ElectricCar. Your new class must: Override the addCustomer method so that new customers are added only if the line is below some maximum capacity. Track the number of customers that refuse to wait because the line was too long. Modify the simulation class so that it uses your new Aisle subclass: everywhere “Aisle” appears in the existing class should be replaced with your new class. You should modify the simulation constructor so that it accepts a “maximum length” parameter that describes maximum allowable length for a checkout line. Modify the printResults method so that it reports the total number of customers that left the store because of excessive line lengths. Test your new simulation using eight aisles, while keeping the other parameters at their default values. How many customers depart when maximum line length is 1? 5?, 20? (INCLUDE AN ANSWER TO THIS QUESTION IN A COMMENT AT THE BOTTOM OF YOUR NEW CLASS. ) Submit your completed Aisle subclass and modified MartSimulation through Canvas. It is your responsibility to make sure that the behavior is correct. If you aren’t sure, check with your instructor or a TA. If you have extra time: Each time this simulation is executed, there is a different result. It might be valuable to know the average results across many different simulation runs. Add a new method to the MartSimulation class with the signature: public void runMany(int numRuns) This method should run the simulation the indicated number of times, and calculate averages for each of the quantities reported. If you have even more time: It would be useful to be able to systematically adjust simulation parameters in small increments to see what effect this has on wait times etc. Add a loop to your main that systematically increases the maximum line length from 0 to 100. For each increment, run your simulation 100 times and report the average results. Last modified April 22, 2022: link to anaylzertest, document matchup constructor (2394349) © 2022 The Docsy Authors All Rights Reserved Privacy Policy About Goldydocs