11-15-2013 HW

posted Nov 15, 2013, 11:36 AM by Samuel Konstantinovich   [ updated Nov 17, 2013, 8:00 AM ]
For everyone:
1. Fix your myList and test program. 
The directions for people that are absent can be found on a readme file on marge:

ssh onto marge.
cat /home/support/konstans/Public/README
Follow the directions to extract your periods files and have access to other people's tests. MY test has the word KonstantTorment in it. Please make sure mine works with your code. I assumed you named it myList, even though some people correctly capitalized your file MyList. 

My program does not test add(index,value) or remove(index), so make sure you test your methods. 



For everyone that got a quiz to work on:
2. Send me an email konstans@stuycs.org . with your results from the quiz you are transcribing The email should have the following format:


Subject:  COLOR <##> Grader: <Last> <First> Period<x>        //EDIT: I changed this line, but will accept any previously submitted "graded by" mails. Don't worry!
Replace the ## and first last, DO NOT put the <>'s
example subjects:
Red 05 Grader: Chen Keiko Period7
Green 01 Grader: Yamaguchi Dave Period10

Body:
1.
<Question 1 text you transcribed>
<results form submitting on coding bat>
2.
<Question 2 text you transcribed>
<results form submitting on coding bat>
3.
<Question 3 text you transcribed>
<results form submitting on coding bat>
4.
<Question 4 text you transcribed>
<results form submitting on coding bat>

Summary:
1. <x>/3 correct
2. <y>/8 correct
3. <z>/17 correct
4. <w>/6 correct

Special notes
<insert if needed, such as the things you had to correct, semicolons, brackets etc.>


####################EXAMPLE BODY########################:
1.
public int[] midThree(int[] nums) {
  return nums;
}
midThree({1, 2, 3, 4, 5}) → {2, 3, 4} {1, 2, 3, 4, 5} X    
midThree({8, 6, 7, 5, 3, 0, 9}) → {7, 5, 3} {8, 6, 7, 5, 3, 0, 9} X    
midThree({1, 2, 3}) → {1, 2, 3} {1, 2, 3} OK

2.
public int[] shiftLeft(int[] nums) {
  return nums;
}
Expected Run
shiftLeft({6, 2, 5, 3}) → {2, 5, 3, 6} {6, 2, 5, 3} X    
shiftLeft({1, 2}) → {2, 1} {1, 2} X    
shiftLeft({1}) → {1} {1} OK    
shiftLeft({}) → {} {} OK    
shiftLeft({1, 1, 2, 2, 4}) → {1, 2, 2, 4, 1} {1, 1, 2, 2, 4} X    
shiftLeft({1, 1, 1}) → {1, 1, 1} {1, 1, 1} OK    
shiftLeft({1, 2, 3}) → {2, 3, 1} {1, 2, 3} X    
other tests X     

3.
public boolean isEverywhere(int[] nums, int val) {
  return true;
}
Expected Run
isEverywhere({1, 2, 1, 3}, 1) → true true OK    
isEverywhere({1, 2, 1, 3}, 2) → false true X    
isEverywhere({1, 2, 1, 3, 4}, 1) → false true X    
isEverywhere({2, 1, 2, 1}, 1) → true true OK    
isEverywhere({2, 1, 2, 1}, 2) → true true OK    
isEverywhere({2, 1, 2, 3, 1}, 2) → false true X    
isEverywhere({3, 1}, 3) → true true OK    
isEverywhere({3, 1}, 2) → false true X    
isEverywhere({3}, 1) → true true OK    
isEverywhere({}, 1) → true true OK    
isEverywhere({1, 2, 1, 2, 3, 2, 5}, 2) → true true OK    
isEverywhere({1, 2, 1, 1, 1, 2}, 2) → false true X    
isEverywhere({2, 1, 2, 1, 1, 2}, 2) → false true X    
isEverywhere({2, 1, 2, 2, 2, 1, 1, 2}, 2) → false true X    
isEverywhere({2, 1, 2, 2, 2, 1, 2, 1}, 2) → true true OK    
isEverywhere({2, 1, 2, 1, 2}, 2) → true true OK    
other tests X

4.
public int[] seriesUp(int n) {
  int[] ans = new int[ n*(n+1)/2];
  return ans;
}
Expected Run
seriesUp(3) → {1, 1, 2, 1, 2, 3} {0, 0, 0, 0, 0, 0} X    
seriesUp(4) → {1, 1, 2, 1, 2, 3, 1, 2, 3, 4} {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} X    
seriesUp(2) → {1, 1, 2} {0, 0, 0} X    
seriesUp(1) → {1} {0} X    
seriesUp(0) → {} {} OK    
seriesUp(6) → {1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6} {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} X    

Summary:
1. 1/3 correct
2. 3/8 correct
3. 9/17 correct
4. 1/6 correct

I had to add semicolons, and change array to int[]
Comments