خرید بک لینک

Vote count: 0

Write a program that finds the number of vowels (‘a’, ‘e’, ‘o’, ‘i’, ‘u’) in a command line argument list. Use a separate thread to do the count for each command line argument. Thus if you have 5 command line arguments, you should spawn 5 threads. Once all threads have finished their work, you should print the total number of vowels found.

Example program runs: java VowelCounter Hello Hello see you in Italy in Venice Number of vowels: 15

Once you have the above working, add an additional complication. Let’s imagine that we will be reading the words in from a file and there will be many words. Modify your program so that we will store the result for each word that is processed. If a word is encountered a second time, a new Thread will not be spawned. Instead, simply lookup the previous result and add it into your summation. To check whether this is working correctly or not, print the number of Threads that you generated. In the example below, only 6 threads should be created because the words Hello and in can simply be looked up. Remember to prevent races from occurring.

java VowelCounter Hello Hello see you in Italy in Venice Number of vowels: 15

asked 33 secs ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 5 تير 1395 ساعت: 6:51

صفحه بندی