For this - final - assignment of the term, you are to write a multi-class application that reads in and processes a text file. For 9/10 points, you merely need to read in the name of a text file and then report the number of sentences in the file. (The number of sentences is the number of periods, exclamation marks (!) and question marks (?) in the file.). To scorre 10/10, you need to read in a file and then present a chart that shows the distribution of sentence lengths in the file. The lengths you should report on are: 0-19 words, and 20 or greater words. (see sample output below).
You will need to use the StringTokenizer class to do the second part of the assignment.
The text file you intend to analyze should be entered interactive by name into a Console window from the element package.
You should show output for the document (TimesDoc.txt) presented below. Note - this document contains some expressions like $50.00 - and so clearly not all "." mark the ends of sentences. Nevertheless you should proceed assuming that sentences end exactly when .,!, or? occur.
ARIS, Dec. 6 - One day before too long, when your mobile
telephone sounds, it could be a novel calling to recount how the
headstrong heroine dumped the handsome heartbreaker. Or it might
be a guidebook surfacing at a critical moment in a crowded bar to
provide you with pickup lines in Spanish, French or German.
The increasing power of cellphones is fast shaping innovative forms
of compact culture: micro-lit, phone soap operas and made-for-
mobile dramas that can be absorbed in less time than it takes to flick
through a book introduction.
Today very few people are using so-called third-generation mobile
services, or smart phones, which allow users to browse the Internet
and watch videos. But most cellphones sold these days have color
screens and the ability to receive picture messages. So media
companies are reinventing quaint old formulas with the aim of
reaching youthful customers.
"Are people going to read 'War and Peace' on their telephones?"
asked David Harper, whose company, Wireless Ink, in Cold Spring,
N.Y., offers Web users cellphone-size literature on such weighty
themes as the zombie apocalypse. "The answer is probably no. Right
now the content on mobile devices is almost like early television.
What they did then was to sit down and do a radio broadcast for the
television screen. But there was a picture. Our mission now is to get
One pioneer is Media Republic, an Amsterdam company that is
successfully reaching young women with the mobile equivalent of
the French "roman photo," a sentimental genre of romantic still
photos and text that dates to the postwar period.
Dutch users register their mobile phones to follow the adventures of
the hormone-driven characters of "Jong Zuid," or "Young South,"
which is now in production for its fourth season. Customers receive
two episodes daily, each with six photographs of well-known Dutch
actors and text describing the travails of glamorous young people
seeking their fortune in the big city.
A weekly subscription costs about $1.50, but most of the revenue
comes from an assortment of corporate sponsors who pay for product
placements, Web advertising and the exclusive rights to sponsor
"Jong Zuid" contests and promotions.
Media Republic and a partner are to produce a similar English-
language version, which will start appearing in Australia this month,
using local actors and scenes. Called "My Way," it is calculated to
appeal to young women, as did the Dutch phone soap, which
attracted 78,000 subscribers, 68 percent of them women, with an
average age of about 18.
Media Republic is planning to bring out other versions of the soap
opera early next year in Germany and in France, where its partner,
NX Publishing, is in the final stages of negotiation with major
French television channels, magazines and mobile telephone
"Everybody is eventually moving to video on mobile, and this
'roman photo' concept is a bridge for those people who are not able
to use videos yet because they need a sophisticated telephone," said
Jean-Michel Blottiere, NX's chief executive. "This is a step that
could lead us very sweetly to video."
The market researcher IDC of Framingham, Mass., predicts that
about 4.5 million smart phones will be shipped to stores this year and
estimates that the number will grow to 35 million by 2008.
Almost two-thirds of the 62 million cellphones shipped in Europe in
the last quarter were camera phones with color screens, according to
Canalys, a technology consulting and research firm based in
London. Only 3 percent of phones sold in Europe last year were
smart phones, but Canalys expects that number to pick up
substantially next quarter.
Still, that hasn't stopped a number of companies from trying to
exploit the potential market. During the Asian Film Festival this
month in Singapore, MediaCorp, a local company, announced that it
was spending a half-million dollars to produce 45 two-minute
episodes of a Chinese-language mobile video drama.
The giant British mobile-phone company Vodafone has struck a
partnership with 20th Century Fox to create a made-for-cellphone
video series, based on the television show "24," which will start
appearing next month in the first of 13 countries. (It will eventually
appear in the United States through Vodaphone's partner Verizon
Wireless.) A British phone manufacturer, I-Mate, has also produced
"Cjaq," a 10-part thriller with video about five young people trapped
in a futuristic nightclub to which they were drawn by a hoax text-
In Japan, major publishers like Shinchosha and Kadokawa Shoten
have created Web sites to offer telephone reading material. Japan is
also home to probably the most successful telephone venture. Earlier
this year a mobile novel jumped from phone screens to the silver
screen, evolving into a feature film, "Deep Love."
In the book industry in the United States, the initial reaction to
mobile-lit is: "Are you kidding?" as one veteran put it.
Still, some major New York publishing houses are pondering the
future. "We are paying attention, but we haven't entered the market
yet," said Kate Tentler, vice president and publisher for Simon &
Schuster Online. "It would be crazy not to look at this. Smart phones
are everywhere and it's the fastest-growing device."
In Europe, even some old-guard publishers have jumped into the
mobile format. The Munich-based Langenscheidt Publishing Group
is a traditional, family-run company that would seem an unlikely
player in this market. It has been publishing dictionaries, travel
guides and map books since 1856 and is run by the fourth
generation of the Langenscheidt family.
This month Langenscheidt started offering a phone-size flirting
dictionary that is its way of promoting international understanding.
For about $5, the service offers 600 or so phrases in the chosen
language, and practical advice including phonetic pronunciations of
The benefit, said Ina Kaese, who manages Langenscheidt's mobile
services, is that if you are a traveler in a foreign city in a busy bar,
your telephone can be your instant guide to romance. It is the mobile
equivalent of the 17th-century Cyrano de Bergerac, who famously
supplied lines to the lovelorn. But certainly not ones like this: "Will
anybody be jealous if I invite you to a cocktail?"
enter a name for a text file
here are the number of sentences of each length