haikuCase

By E.Hooijmeijer

1 Introduction Haiku is one of the most important forms of traditional japanese poetry. Haiku is, today, a 17-syllable verse form consisting of three lines of 5, 7, and 5 syllables and the inclusion of a seasonal reference. So the first line has 5 syllables, the second 7 and the third 5 and one of the lines should contain a reference to a season. 2 Assignment The program that needs to be written for this assignment must be capable of checking haiku for correctness. The haiku's are offered to the HaikuChecker interface. Whenever a Haiku is incorrect a InvalidHaikuException needs to be thrown containg a message descripting the fault. The program needs to perform the following checks : - The haiku must consist of 3 lines. - The first line must contain 5 syllables. - The second line must contain 7 syllables. - The third line must contain 5 syllables. - There must be at least one reference to a season. To ease devlopment the seasons are defined in the Haiku Interface. 3 Example Examine the following (correct) Haiku : "smetteloos bloesems" -> 1st line, 5 syllables "de lentezon kent haar naam" -> 2nd line, 7 syllables and a season reference. "de vlinder dwarrelt" -> 3rd line, 5 syllables, 4 Tips Counting syllables is not that hard. Its a matter of counting groups of vowels in a word. For example 'pIndAkAAs' has three syllables and 'bIEr' has only one. Succes !
Test case 1 : Real Haiku #1 Invoer : { "De blaadjes ruisen","een flits doorklieft de hemel","Onweer in de herfst" } Gewenst resultaat : Goedkeuring. Test case 2 : Real Haiku #2 Invoer : { "nieuwe bloem ontluikt","raakt snaren van verlangens","zomerbelofte" } Gewenst resultaat : Goedkeuring. Test case 3 : Real Haiku #3 Invoer : { "het gouden herfstlicht","zachte tooi in het heden","wat moet dat worden" } Gewenst resultaat : Goedkeuring. Test case 4 : Real Haiku #4 Invoer : { "de winterse storm","voetstappen zien in de sneeuw","anijsmelk drinken" } Gewenst resultaat : Goedkeuring. Test case 5 : Real Haiku #5 Invoer : { "smetteloos bloesems","de lentezon kent haar naam","de vlinder dwarrelt" } Gewenst resultaat : Goedkeuring. Test case 6 : Faulty Haiku #1 Invoer : { "nasigoreng babipangang sambal bij?","zo sprak de chinees","Tewijl het zomerde" } Gewenst resultaat : Afkeuring. Test case 7 : Faulty Haiku #2 Invoer : { "Haiku Haiku oe","Haiku Haiku Haiku Hai","Haiku Haiku uu" } Gewenst resultaat : Afkeuring. Test case 8 : Faulty Haiku #3 Invoer : { "het stille bloesemtje","de lente vertelt door een bloem","een vinder dwarrelt" } Gewenst resultaat : Afkeuring. Test case 9 : Faulty Haiku #4 Invoer : { "het stille bloesemtje","de lente door een bloem","een vinder dwarrelt" } Gewenst resultaat : Afkeuring. Test case 10 : Faulty Haiku #5 Invoer : { "een winterse storm","de vorst komt met vlagen","sneeuwbal vliegt" } Gewenst resultaat : Afkeuring. Test case 11 : NULL Array Test Invoer : null Gewenst resultaat : Afkeuring. Test case 12 : NULL Array Elements Test #1 Invoer : { null,null,null } Gewenst resultaat : Afkeuring. Test case 13 : NULL Array Elements Test #2 Invoer : { "","",null } Gewenst resultaat : Afkeuring. Test case 14 : Too Short Array Test Invoer : { "","" } Gewenst resultaat : Afkeuring. Test case 15 : Too Long Array Test Invoer : { "","","","" } Gewenst resultaat : Afkeuring. Test case 16 : Hoofdletter check Invoer : { "Zomer en Winter","WOrdEn gEschEIden dOOr dE","Herfst en de Lente" } Gewenst resultaat : Goedkeuring.