Class Note for C SC 127A at UA
Popular in Course
Popular in Department
This 1 page Class Notes was uploaded by an elite notetaker on Friday February 6, 2015. The Class Notes belongs to a course at University of Arizona taught by a professor in Fall. Since its upload, it has received 20 views.
Reviews for Class Note for C SC 127A at UA
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 02/06/15
C Sc 127A Monday 10Nov Scribe39s Section Leader Collaboration Work in teams of 2 The scribe is the person born closest to this room Write the scribe39s section leader above and both names below 1 2 Problem Add method substring to class String127A to return a new java langString like that String class already does Assume the indexes are in range and the 1st int argument lt 2quotd int argument These assertions must pass String127A str new String127Aquotabcdquot assertEqualsquot strsubstringl 1 empty string assertEquals a strsubstring0 l assertEquals abcquot strsubstring0 3 assertEqualsquotabcdquot strsubstring0 4 assertEqualsquotbcdquot strsubstringl 4 assertEquals quotcdquot strsubstring2 4 strsubstring3 4 strsubstring4 4 assertEquals assertEquals A mutable string type public class String127A private int n private char theChars Precondition initialStringlength lt 128 public String127AString initialString theChars new char128 n initialStringlength for int i 0 i lt n i theCharsi initialStringcharAti l public int length l return n l Precondition index is in range of 0size e 1 public char charAtint index return theCharsindex Preconditions beginIndex is in range of 0si endIndex is in range of 0siZe beginIndex lt endIndex public String substringint beginIndex int endIndex ze 0
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'