Question: Assignment #1 Due date: Feb. 7 at 11:59pm, submit . c file on Canvas Write a program that translates an alphabetic phone number into numeric

Assignment #1

Due date: Feb. 7 at 11:59pm, submit .c file on Canvas

Write a program that translates an alphabetic phone number into numeric form:

Enter phone number: CALLATT

2255288

(ln case you don't have a telephone nearby, here are the letters on the keys: 2:ABC. 3:DEF.

4:GHI. 5:JKL, 6:MNO. 7:PRS. 8:TUV. 9:WXY) If the original phone number contains

non-alphabetic characters (digits or punctuation, for example), leave them unchanged:

Enter phone number: 1-800-COL-LECT

1-800-265-5328

You may assume that any letters entered by the user is upper case.

(use if/else statements, getchar() and putchar() for reading the entries and writing the substitutes, respectively. Please note, as an example, you can use putchar(1) to write 1 or putchar(ch) to write the character stored in ch)

Only submit your .c file

  1. Make sure you have an account on the student cluster.
  2. Make sure you have installed Putty and WinSCP (or MobaXterm) if you have a Windows PC, and know how to connect to the cluster on a Mac.
  3. Type the following commands on sc after you log in: mkdir cop3515 cd cop3515
  4. Create a phone program.
  5. Test it with gcc Wall o name.c
  6. Run ./name.c
  7. Download the file to your local drive.

1. Write your program and name your program phone.c

2. Assume the input will be only uppercase.

Before you submit:

1. Compile with gcc Wall. Wall shows the warnings by the compiler. Be sure it compiles on sc (student cluster) with no errors and no warnings.

gcc Wall o phone phone.c

2. Be sure your Unix source file phone.c is read & write protected. Change Unix file permission on Unix:

chmod 600 phone.c

  1. Run ./phone
  2. Download the file to your local drive.

3. Test your program with the following examples:

a. AAB-12C-0318

b. 813-888-ABCD

c. ASBCDNM

4. If the expected outputs are correct, you are good! Rename your program to lastname_phone.c (insert your own lastname instead of the first part) and submit it on Canvas>Assignments for this project.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!