7.字符数统计(满分50分)版本1:满分15分Writeamethodthatcountsthenumberoflettersinastringusingthefollowingheader:publicstaticintcountLetters(Strings)Writeatestprogramthatpromptstheusertoenterastringanddisplaysthenumberofoccurrencesoflettersinthestring.版本2:满分20分Writeaclassthatdisplaysthenumberofoccurrencesofeachletterinastringusinghistogram.Theclassheadershouldbe:publicclassHistogramextendsJPanel{…}WriteatestprogramthatpromptstheusertoenterastringanddisplaysahistogramofthenumberofoccurrencesofeachletterinthestringusingHistogramclass.Thedisplayisasshownasfollowingfigure:版本3:满分20分WriteaprogramthatpromptstheusertoenterthenameofanASCIItextfileanddisplaythefrequencyofthelettersinthefileusingfollowingdesign:publicclassShowFrequency{publicstaticvoidmain(String[]args)throwsException{….BufferedInputStreamfileInput=newBufferedInputStream(newFileInputStream(newFile(filename)));….}}
1