The phone numbers of the companies are stored in the phones.txt. The area codes are missing in some of the phone numbers. (A phone number including area code is 10 characters). You will write a program to format phone numbers and add area code if necessary. At the end all the phone numbers will look like the following; (312) 4250204. Write the following functions; readFromFile that reads all the phone numbers from the file phones.txt into a string array. The function should return the number of phones. updateDirectory that takes the string array which keeps the phone numbers and the number of phones in the array as parameters, and updates the phone numbers adding the parentesis and area code (312) where necessary (i.e (312) 4250204). printDirectory that takes the string array which keeps the phone numbers and the number of phones in the array as parameters, and displays the number of phones and the phone list on the screen.

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter16: Graphics
Section: Chapter Questions
Problem 12RQ
icon
Related questions
Question

IN C Programming Language...THANKS

The phone numbers of the companies are stored in the phones.txt. The area codes are missing in some of the phone numbers. (A phone number including area code is 10 characters). You will write a program to format phone numbers and add area code if necessary. At the end all the phone numbers will look like the following; (312) 4250204.

Write the following functions;

  • readFromFile that reads all the phone numbers from the file phones.txt into a string array. The function should return the number of phones.
  • updateDirectory that takes the string array which keeps the phone numbers and the number of phones in the array as parameters, and updates the phone numbers adding the parentesis and area code (312) where necessary (i.e (312) 4250204).
  • printDirectory that takes the string array which keeps the phone numbers and the number of phones in the array as parameters, and displays the number of phones and the phone list on the screen.
phones.txt
Example Run:
There are 8 phone numbers in the directory
(312) 4250204
3124250204
2660408
(312) 2660408
(312) 2748540
3122748540
(312) 3659874
3123659874
3123547862
(312) 3547862
(312) 2660808
(312) 2905128
2660808
2905128
(312) 4421578
3124421578
Transcribed Image Text:phones.txt Example Run: There are 8 phone numbers in the directory (312) 4250204 3124250204 2660408 (312) 2660408 (312) 2748540 3122748540 (312) 3659874 3123659874 3123547862 (312) 3547862 (312) 2660808 (312) 2905128 2660808 2905128 (312) 4421578 3124421578
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning