Sunday, April 22, 2007

Notes on Homework 1 Grading

-------------------------------------------------
Notes on grading this project
-------------------------------------------------

CS 10 - Java
Spring 2007
Homework 1

Graded by Mock Suwannatat
mock@cs.ucsb.edu

CRITERIA:
(Only a guide.)

--- Part 1: Reverse Product ---
10 points total
There are 4 tests, 3 points each.
Maximum 4 points if do not compile.

--- Part 2: Fractions ---
15 points total
There are 4 tests, 4 points each.
Maximum 4 points if do not compile.

--- Part 3: Triangle ---
15 points total
There are 4 tests, 4 points each.
Fore each test,
-2 for the first wrong output.
-1 point for each subsequent wrong output.
Maximum 4 points if do not compile.


LESSONS LEARNED:
This is where many people got it wrong:

- Your output and prompt messages should match the sample exactly.
+ Do not print anything extra.
+ Stick with the sample output: for example: last fraction term should be 1/1 not 1
+ I did not take points off this time, except in very rare cases.
- The ^ operator is not "power". It is XOR. So, when you write x2 = x^2; you may want to write Math.pow(x, 2); instead.
- Area formula of 0.5*side1*side2 would be correct only when it's a right triangle.
- Your program should terminate after producing the output. If the assignment does not say explicitly that you should keep asking for input, then don't.
- If you are asked to fill in the methods, then leave them blank if you don't know how to write them. Do not erase the method headers. Do not modify the headers.

TIPS & TRICKS:
The following tips may be useful for later projects. I gave some of them out to a few people who visited my office hours and asked. I did not give them to everyone because I did not want to spoil the fun ;)

Tip #1: How to convert number to String?
Say, you have an int x.
- First way: String s = (new Integer(x)).toString();
- Second way: String s = "" + x;

Tip #2: How to reverse a String?
- First way: write a for loop yourself.
- Second way: Say, you want to reverse s1 and store the result in s2, you write:
StringBuffer sBuffer = new StringBuffer(s1);
sBuffer.reverse();
s2 = sBuffer.toString();
Note that the String class is immutable, so there is no reverse() method for String. But the StringBuffer class is mutable, so you can make use if it. Next time, when you work on String, you may want to look at how you can use the StringBuffer class. (But you don't need it.)

FINAL WORDS:
Many people did a really good job. Have fun on hw2 (and others). If you feel like needing help, please visit the office hours. I've seen many cases where you "almost got it" and I could really help by giving some simple guides or hints -- but you need to ask :)

No comments: