Midterm-v2-solution

Remainder103 returned expected but the expected answer

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: may assume that the appropriate elements have been imported (i.e. you may use any JUnit element without using its fully qualified name). You may not assume that any instance variables are defined in the testing class (in other words – if you need a variable, define it locally). Assume that the Calculator class has a no ­argument constructor. @Test public void testRemainder() { Calculator calc = new Calculator(); int expected = 1; // the expected answer for remainder(10,3) int actual = calc.remainder(10,3); assertTrue(“calc.remainder(10,3) returned ”+expected+“, but the expected answer is ”+expected, expected==actual); } 3 [ CSE116 – MIDTERM EXAM, VERSION 2] SPRING 2010 Question 3 [10 marks] Part a [4 marks] Suppose we execute the following code: LRStruct<String> myList = new LRStruct<String>(); Draw a diagram showing the structure of the LRStruct referred to by myList. Be sure to show each LRStruct object and each state object in the structure, along with any String objects contained in myList. myList _state LRStruct Empty Par...
View Full Document

This note was uploaded on 08/19/2013 for the course CSE 1156 taught by Professor Alhonce during the Fall '11 term at SUNY Buffalo.

Ask a homework question - tutors are online