W12:Labs:lab03
From 56wiki
CS56—Advanced Applications Programming—W12
W12:Exams | W12:Homework | W12:Labs | W12:Calendar and Lecture Notes | W12:Syllabus | W12:Choice |
---|
lab00 | lab01 | lab02 | lab03 | lab04 | lab05 | lab06 | lab07 | lab08 |
Contents[hide] |
lab03: Inheritance, overriding equals
This week, practice with
- using inheritance
- using an ArrayList
- overriding equals
- overriding toString
- problem solving
assigned | due |
---|---|
Thu 02/02 | Fri 02/10, 5pm |
Special instructions for those working in a pair
If you are working in a pair and you ALSO worked in the SAME pair on lab01, YOU MUST READ THIS.
We want to STRONGLY ENCOURAGE appropriate pair-partner interactions and DISCOURAGE inappropriate pair-partner interactions. SO:
- Define "A" as the pair partner who was the "initial driver" last week---i.e. you did the lab in As account, and submitted from As account last week.
- Then you MUST work in "B"s account this week and submit from B's account. Otherwise, NEITHER PAIR PARTNER WILL GET CREDIT FOR THIS WEEK'S LAB.
- Also, if we find that "A" is working in "B's" account without B present, or vice-versa (e.g. via inappropriate sharing of passwords), that will be considered ACADEMIC DISHONESTY and we reserve the right on a first offense, to give you a permanent zero on the lab in question, and report the matter to Student Affairs, and to the Engineering system management staff (as a terms of service violation.)
- If a second offense were to occur, we reserve the right to issue of course grade of F for repeated academic dishonesty.
Overview
This lab will build on the material we introduced about Ant and JUnit in lab01 and lab02.
You will also apply what you learned about inheritance, object equality, and using the ArrayList class from your textbook readings
Step-by-Step
Step 1: Preliminaries
(1a) Create a ~/cs56/lab03 directory.
(1b) Copy the build.xml from your lab02 directory into your lab03 directory, and change the projectName property.
(1c) Create a ~/cs56/lab03/src directory
(1d) Copy two .java files from the web page below into your src directory:
http://www.cs.ucsb.edu/~pconrad/cs56/12W/labs/lab03/code
You can copy these:
- using a cp command from ~pconrad/public_html/cs56/12W/labs/lab03/code/*
- using a wget command on each file's URL
- doing a "save as" from the web browser, if your web browser is running on CSIL
(1e) Create a ~/cs56/lab03/html directory. Copy the index.html from last weeks lab into this directory, and edit the file to reflect that this is lab03 (changing the names if needed).
Step 2: Java Programming
Your programming task in this lab are simply to replace the stubs in Polynomial.java with code that
- implements the methods described in the javadoc comments
- passes the unit tests in PolynomialTest.java
- passes any other reasonable unit tests that the TAs might devise!
Tip
It is possible that there may be typos/errors in the unit tests themselves. If you suspect this, please post something on the Gauchospace forum "Report Errors in Unit Tests Here". The FIRST person/pair partner to CORRECTLY identify each incorrect unit test (supplying a correct test in its place) will receive extra credit.
For any other typo corrections, please use the "discussion" link on the 56wiki.
I suggest that you work in this order:
- do toString first. Having this correct will help you with the output of the JUnit test cases for the other methods.
- do equals next. If this isn't right, you can't properly even run the tests for plus, times and minus
- do plus, then times, then minus. I think you'll figure out as you do times and minus why that's the best order!
When all the tests pass, you are ready for your final check over, then turnin.
Step 3: checking over your code
Before you proceed further, check over the items in the rubric at the end of this lab file to ensure that you didn't leave anything out that would cause you to lose points!
- It is best to do this in pair-programming fashion, with one partner reading the checklist, and the other checking the code.
- Even if you "solo programmed" this lab, you may want to see if you can find someone in the lab that also solo programmed, and ask him/her to be a "rubric buddy" with whom you can take turns doing this checklist step.
Note that it is ok if you have stuff in your build.xml file that we aren't using this week such as the following items. Leave them in, because they'll be useful in future labs.
- Putting a manifest in your jar (we don't really have a main program this week to worry about)
- Running code from someone else's directory
- etc.
Do the "ant publish" step and make sure that your links work for the javadoc and the jar file though.
Step 4: ant clean, then turnin
Note: Remember to do an ant clean before doing your turnin.
From the ~/cs56
directory, the turnin command is:
turnin lab03@cs56 lab03
Then, after you do the turnin, do the ant publish step one more time and check the web just to ensure everything is online and up-to-date.
Grading Rubric: Total Points: 300
Partial credit may be awarded for each step at the discretion of the TA/Instructor.
Mechanics
- (5 pts) Executing the turnin step on a directory called lab03
- (5 pts) Having two .java files named Polynomial.java and PolynomialTest.java (Not at the top level directory!)
- (5 pts) No build subdirectory is present in the submission, because you did a clean first before submitting
- (5 pts) There is a build.xml file in your submission
- (5 pts) There is an html subdirectory that contains an index.html file.
Polynomial.java
All of these must pass tests, be written in good style, and have appropriate Javadoc comments to get full credit.
- (40 pts) toString
- (30 pts) equals
- (40 pts) plus
- (40 pts) times
- (20 pts) minus
Build.xml
To get full credit for any item in this list, the item must be present, AND must do its job correctly.
- (25 pts) build.xml file has all elements required from lab03
- (5 pts) step 2: change project name property
Web page
The web page and its contents (deductions of 5-10 points may be made for each item from list below that is not completed)
- (5 pts) html directory exists inside submitted lab03 and contains index.html
- (5 pts) html/index.html file contents look reasonable
- (5 pts) file is available on the web at http://www.cs.ucsb.edu/~username/cs56/lab03
- (5 pts) ant publish target copies that to the web
- (5 pts) student's web page has javadoc and download links that link to correct content (javadoc for javadoc, and jar file at the download link.)
General Good Practices
- (30 pts) Following Instructions
- If there is anything that you should have done that was in the instructions but isn't already covered elsewhere in the grading rubric, these points are the ones that are "at risk" for those items.
- Late submissions ALWAYS lose all of these points--and are subject to receiving a zero if the TA has already finished grading the assignment before the submission is received. TO ENSURE THAT YOU GET CREDIT, SUBMIT BEFORE THE DEADLINE.
- (20 pts) Coding Style
- By this point in your programming career, you should know about things like using good variable names, indenting properly, factoring out common code into a subroutine, etc. Anything that is an obvious defect in your code is something that TAs have discretion to deduct points for, up to the amount specified for this item.
Due Date
You should do your best to complete this within the assigned lab time during week 4 of the quarter.
If that is not possible, then you should complete the assignment and execute the turnin command no later than 5pm Friday of week 4 of this quarter. This gives you one full week to seek help during office hours from both the instructor and the TAs, plus one additional lab period to ask the TAs for additional help.
Submissions turned in after that time are subject to receiving zero credit.