Note for C SC 127A at UA
Popular in Course
Popular in Department
This 2 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 26 views.
Reviews for 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 15Sep Section Leader Name import static orgjunitAssert import orgjunitTest public class SeveralMethodsTest Test public void testSleepln SeveralMethods myMethods new SeveralMethods There are only 4 possible tests assertTruemyMethodssleeplntrue true assertf lsemyMethodssleeplntrue false assertTruemyMethodssleeplnfalse true assertTruemyMethodssleeplnfalse false 1 Test public void testMakeAbba SeveralMethods myMethods new SeveralMethods assertEqualsquotHiByeByeHiquot myMethodsmakeAbbaquotHiquot quotByequot assertEquals quotYoAliceAliceYoquot myMethodsmakeAbbaquotYoquot quotAlicequot assertEquals yyxquot myMethodsmakeAbba quotyquot assertEqualsquotquot myMethodsmakeAbbaquotquot quotquot l Test public void testLastDigit SeveralMethods myMethods new SeveralMethods assertTruemyMethodslastDigit7 17 assertTruemyMethodslastDigit1243 3 assertTruemyMethodslastDigit0 10 assertf lsemyMethodslastDigit5 4 assertf lsemyMethodslastDigit54 45 assertf lsemyMethodslastDigit6 17 l Write method missingChar here Include at least three assertions l End class SeveralMethodsTest Collaboration Work in teams of 2 each person must submit this page for credit Problem Given a nonempty string and an int 11 return a new string where the char at index n has been removed For example missingChar quotkittenquot 4 returns quotkittnquot The value of n will be a valid index of a char in the original string ie n will be in the range 0str 1ength1 inclusive 1T0 class SeveralMethodsTest add atest method for missingChar String int 2 On the back ofthis page complete method missingChar to class SeveralMethods public class SeveralMethods The parameter weekday is true if it is a weekday and the parameter vacation is true if we are on vacation We sleep in if it is not a weekday or we39re on vacation Return true if we sleep in public boolean sleepInboolean weekday boolean vacation return lweekday H Vacation Given two nonenegative int values return true if they have the same last digit such as with 27 and 57 Note that the quotmodquot operator computes remainders so 17 10 is 7 public boolean lastDigitint a int b return a 10 10 Given two Strings A and B return a new String of the form ABBA So for example with the Strings quotHiquot and quotByequot return quotHiByeByeHiquot public String makeAbbaString a String b return a b b a Given a noneempty string and int n return a new string where the char at index n has been removed ie missingCharquotkittenquot 4 returns quotkittnquot Complete missingChar here with the method heading End method missingChar End class SeveralMethods
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'