you need to use python to solve it.

yyk112233
Assignment9.pdf

CS21 Assignment #9

Please use the given name for your scripts!

1. (telephone.py) Complete Programming Exercise #5 on page 435 in your textbook. A sample run:

Enter the telephone number in the format XXX-XXX-XXXX: 802-GOT-FOOD

The phone number is 802-468-3663

2. (characters.py) Complete Programming Exercise #7 on page 435 in your textbook. The file referenced in the problem does not exist, so I have provided two text files (“TheOdyssey.txt” which contains the text of “The Odyssey, Book1” and “DeclarationOfIndependence.txt” which contains a transcription of the Declaration of Independence) for your use. Your program should prompt the user for the filename. Don’t forget to use exception handling to deal with file issues.

Enter the filename: TheOdyssey.txt

Uppercase letters: 338

Lowercase letters: 16265

Digits: 3

Spaces: 4200

3. (characters2.py) Complete Programming Exercise #10 on page 436 in your textbook. Testing should be case-

insensitive (‘a’ and ‘A’ count for the same letter).

Sample run #1:

Enter a string: An apple a day keeps the doctor away

The most frequently occurring letter(s): A

Sample run #2:

Enter a string: Today is Tuesday

The most frequently occurring letter(s): A D S T Y

Reminders (not following will result in point deductions):

 It is expected that you will use exception handling and error handing to ensure your programs are robust and

will not crash.

 If a function’s task doesn’t include output to the user, do not do it!

 Use constants! No magic numbers! No global variables!

 It is expected that you will complete the same process of development that we use in class. When you reach the

point of having an algorithm (pseudocode), this will become the comments of your program as a starting point

for writing code. Comment first, then code!

 Be sure to include comments at the top of the program that include your name, class and a short description of

the program.

 Each function should begin with a comment describing the task the function will perform.

 Be sure all output is formatted. Unless otherwise, specified, displays non-integer values with 2 digits after the

decimal point.

Any work you submit for this assignment should be authored entirely by yourself. Assistance is permitted from the

instructor or teaching assistants only. All submitted programming assignments are subject to originality verification

through software designed and used for the Measure Of Software Similarity (MOSS).