Starting from:

$30

HomeWork-4 Alphabetic Telephone Number Translator


HomeWork-4
You must write name header on the top of every
homework assignment. (It will include your name, id,
homework number).
Note: In all these exercises, pay attention on
documentation. User has no idea about your code and your algorithm. Keep your output “user
friendly” so that user can understand what s/he is doing.
Exercise 1: (Alphabetic Telephone Number Translator)
Many companies use telephone numbers like 555-GET-FOOD so the number is easier for their
customer to remember. On a standard telephone, the alphabetic letters are mapped to numbers in
the following fashion:
A, B, and C = 2
D, E, and F = 3
G, H, and I = 4
J, K, and L = 5
M, N, and O =6
P, Q, R, and S = 7
T, U, and V =8
W, X, Y, and Z = 9
Write a program that asks the user to enter a 10 character telephone number in the
Format XXX-XXX-XXXX.
The Application should display the telephone number with any alphabetic characters that appeared
in the original translated to their numeric equivalent. For example, if the user enter 555-GETFOOD, the application should display 555-438-3663
Exercise 2: (Login Name)
At a university, each student is assigned a system login name, which the student uses to
log into the campus computer system. As part of your internship with the university’s
Information Technology department, you have been asked to write the code that
generates system login names for students. You will use the following algorithm to
generate a login name.

1. Get the first three characters of the student’s first name. (If the first name is less
than three characters in length, use the entire first name. Note: Student is allowed
to enter his full first name regardless of its length. As a programmer, you just care
about first 3 letters of his/her name )
2. Get the first three characters of the student’s last name. (If the last name is less
than three characters in length, use the entire last name. Just like first name, user
can enter any size of his/her last name)
3. Get the last three characters of the student’s ID number. (If the ID number is less
than three character in length, use the entire ID number.)
4. Concatenate the three sets of characters to generate the login name.
For example, if a student’s name is Amanda Spencer, and her ID number is ENG6721,
her login name would be AmaSpe721. You decide to write a function named
get_login_name that accepts a student’s first name, last name, and ID number as
arguments, and returns the student’s login name as a string.
Exercise 3: (Validate Password)
At the university, passwords for the campus computer system must meet the following
requirements:
 The password must be at least seven characters long.
 It must contain at least one uppercase letter.
 It must contain at least one lowercase letter.
 It must contain at least on numeric digit.
When a student sets up his or her password, the password must be validated to ensure it
meets these requirements. You have been asked to write the code that performs this
validation. You decide to write a function named valid_password that accepts the
password as an argument and returns either true or false, to indicate
whether it is valid.
Exercise 4: (Triangle Pattern)
Print this triangle of Z using for loop, range, how many times Z will
print, use the multiplication operator to print that many Z’s. Do not
print that many Z’s in print statement.

More products