Programming Assignment 1 – Summer 2003 COMP 111 Lab 1 – Winter 2020 Scenario As a new Software Engineer for the Enterprise Biological Solutions company, you’re excited (but also a little nervous) as...

help i am lost


Programming Assignment 1 – Summer 2003 COMP 111 Lab 1 – Winter 2020 Scenario As a new Software Engineer for the Enterprise Biological Solutions company, you’re excited (but also a little nervous) as you head to your boss’s office to get your first assignment. You’re determined to prove yourself on this assignment. After all, you’re shooting to fast track to a Senior Software Engineer position. You wonder how large a raise you’ll get when that happens. Your mind stops wandering when you reach the office. You tentatively knock on the open door. “Come in, come in!” your boss’s voice booms out. She’s known to be friendly and personable but has very little tolerance for shoddy workmanship and missed deadlines. After exchanging pleasantries, your boss gets down to business. “A major part of our business is breeding and shipping rats for research, but a new marketplace is developing for the sport of Rat Racing. Maybe you’ve seen it on ESPN2. Rats are “trained” by learning how to traverse a maze from start to finish. A rat cannot be considered as fully trained until it has proceeded through a series of trials with the time for each trial recorded as the rat moves from start to finish. An error is recorded when a rat turns away from the correct path leading from start to finish. A criterion is established for “learning” (e.g., 8 errorless trials in a row). When a rat is shipped, it is certified with the number of trials it took to meet the learning criterion as well as the total time for all trials. “We need to modernize the inventory and testing process that the rats go through. We’re going to set up a database for them, a wireless network, and hand held devices so that they can track inventory and record results for the testing that they do of the rats before shipment. The rats have embedded RFID (radio frequency identification) devices so that accurate race times can be determined. It’s a pretty exciting project.” Your head is swimming. You manage a weak smile. Your boss continues, noticing your thinly disguised discomfort. “We have a database team that will handle the data persistence and a network and middle-tier team that will design the network and deploy the application. You don’t have to worry about any of that. As our up-and-coming object-oriented design and programming expert, all you have to do is design, code, and test the classes necessary to model the information about a rat.” You start to breathe a little easier. “So, let’s break things down into pieces. You’ll eventually end up with a working prototype of an inventory management system, but as your first task I just want you to model the information about a rat. A rat is the entity that the company tracks and will of course be a key component of the application. Make the mechanism for keeping track of the number of times to meet the learning criterion and the total time for all trials very simple for this first step and go ahead and make it part of your Rat entity for now. “Your predecessor took a crack at this – have a look at this code,” your boss frowns as she slides a folder in your direction. “But I don’t think it even compiled!” “Don’t forget” she continues, “that we use the test-driven development (TDD) methodology at this company, with JUnit as our class method testing framework. Before fixing your predecessor’s class methods, write your JUnit test methods. The JUnit classes are considered to be as important as the classes, and your Senior Software Engineer mentor will report back to me how robust your unit test classes are.” You leave the office and begin working on your assignment. You see that your predecessor adhered to object-oriented design principles by abstracting only those attributes that are relevant to the problem domain. Each rat has an RFID tag placed below the skin shortly after birth, so a 9-character string uniquely and permanently identifies it. Protocol is to have the rats run through a standard maze and record the total number of trials and the total time for all trials. This information is reflected in the instance variables (attributes) for the Rat class: Attribute Type Value/Range RFID chip number text Characters containing 0-9, A-Z, and a-f Default value: null number of trials whole number Number of trials to criterion Default value: 0 total time for trials whole number Number of seconds for all trials Default value: 0 You have been instructed to not worry about data validation of any of the attributes for this prototype. There are two constructors, one with no parameters (sort of a Rat “placeholder” until the attributes are known) and another that takes in parameters (RFID, number of trials, total seconds). You confirm there is a “get” and “set” method for each attribute. You decide to code a toString() method that will provide text of the criterion for a given Rat object per the following example: Rat RFID OH12345 12 trials totaling 1 hour(s) 18 minute(s) 5 second(s) Average trial time was 390.41 seconds You think about how you can do that. You know you will have total seconds. If you divide total seconds by 3600 and discard the remainder, you will have total hours. Subtracting that number times 3600 from the total seconds will give you an intermediate value on which you can follow a similar approach to get minutes; then eventually seconds will be left over. Yes, you think you’re on to something! For example, a time of 9788 seconds would convert to 2 hours(s) 43 minute(s) 8 second(s). You now turn to writing test methods using the JUnit test framework. Armed with the test methods, you get to work. First you remove compile errors from your predecessor’s attempt at coding Rat. Then you proceed to use your test methods to systematically find and correct any logic errors in the Rat class. Assignment 1. A starter BlueJ project will be provided to you. It will contain three classes - Rat, RatTest, and RatDriver. The version of the Rat class will have all methods coded, although it wlll contain both syntax and logic errors. The RatTest class will have some of the methods completed to help get you started and provide syntax/approach that can be used to complete your coding. You will need to find and fix any syntax errors, complete and compile the Rat class and the corresponding RatTest class as specified in the comments within the code and per these requirements. As you test the Rat class, fix any logic errors you find. 2. You must use the provided project file and develop the lab within the BlueJ IDE to complete this assignment. 3. Do NOT change the name, return type, or parameter order/type of any of the class methods. These same attributes are used by Web-CAT to grade your submission, and you will end up losing points if they are changed. 4. Each class constructor and method should be tested by a unit test method. Besides serving to verify that your code is accomplishing what you intended, writing unit test methods helps you understand how the objects should behave (how the class methods create, access and mutate the object). That is, writing the test methods first helps guide your class coding efforts. Follow these steps to complete this assignment: a. Find and correct any syntax errors so that the classes in the project compile cleanly. b. Review the first JUnit test method, completing the code if necessary. Note that proper testing includes making manual calculations to verify that expected values for a method action are equivalent to actual results. c. Once you feel the unit test method is a valid and robust test of the method’s expected behavior, review the corresponding class constructor or method and complete the coding if necessary. d. Run the JUnit test for the method. If it does not pass, review and correct the code for this method. e. When the test passes, continue in like manner for the next and subsequent methods, iteratively completing tests and developing your class or classes. All methods in classes must be tested. 5. All classes must compile cleanly. 6. Check your programming style using the “Checkstyle” tool provided with BlueJ (Tools Checkstyle). 7. Document the overall project in the README file as directed in the Action Items for the Lab. 8. Submit your completed lab to Web-CAT using BlueJ (Tools Submit) and review the Web-CAT results for errors. Repeat the above steps as needed to resolve any errors. 9. Note that the driver class RatDriver included in the project file is simply to provide a visual confirmation of correct class behavior. It is not part of the actual solution. You can modify it if that is helpful to you, but the driver class will not be reviewed by either your instructor or Web-CAT.
Feb 12, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here