For this assignment you are required to write one of the following programs. If your student number is an “odd number”, write the program named CountVowels.java. If your student number is an “even number”, write the program named CountPunct. (In case you’re not sure, a student number is “odd” if the last digit is 1, 3, 5, 7, or 9.)
CountVowels a Java program to count the number of vowels in a text file. This program should read text from the standard input (the keyboard, or a file using input redirection) and count the number of occurences of the letters a, e, i, o, and u. As well, count the total number of characters read. The results should be sent to the standard output. Your output should begin with a banner including the course code, the assigment number, your name, and your student number.
An example dialogue follows (user input is underlined):
PROMPT>java CountVowels < example.txt
*****************************
* ITEC 1011 M - Winter 2001 *
* Assignment #6 *
* Name: Scott MacKenzie *
* Student Number: 123456789 *
*****************************
Total number of characters = 13153
Number of vowels...
a = 673
e = 1088
i = 656
o = 738
u = 251
PROMPT>
CountPunct same as above, except count the punctuation characters period (“.”), comma (“,”), colon (“:”), semicolon (“;”), and question mark (“?”).
An example dialogue follows (user input is underlined):
PROMPT>java CountPunct < example.txt
*****************************
* ITEC 1011 M - Winter 2001 *
* Assignment #6 *
* Name: Scott MacKenzie *
* Student Number: 123456789 *
*****************************
Total number of characters = 13153
Number of punctuation characters...
periods = 158
commas = 77
colons = 73
semicolons = 0
question marks = 0
PROMPT>
As a reminder, if your student number is an “odd number” write the CountVowels program. If your student number is an “even number”, write the CountPunct program.
Submission:
The assignment is due during the lab on the date noted above. If you wish to hand in the assignment
earlier, please drop it off at the course instructor’s office (Ross, N603)
during his office hours (Wed 1:00-2:20, Fri 11:30-12:30). You may slide it under the door, if he’s not
around.
Hand in your solution on a 3.5” floppy disk. The disk should contain just one file: the source file for your program. The source file must include comment lines at the top containing your name and student number.
The disk jacket must have a label containing the following information:
· Course code and section (ITEC1011 – M)
· Assignment number (Assignment #6)
· Your name and student number (e.g., Jayne Student, 201234567)
· Name of source file (e.g., CountVowels.java)
As a precaution, keep a copy of the source file you submit (and do not make changes to it!).
Late penalty:
Solutions will be posted on the course web site immediately after the lab
on the date noted above. Therefore,
assignments cannot be handed in late (i.e., the penalty will be 100%).