C++ visual studio functions and arrays

May 12th, 2015
DotaCN
Category:
Computer Science
Price: $40 USD

Question description

1.  Write a complete program that receives a single phone number from the keyboard as a string and then passes it to a filter function (by reference).  The function should ERASE all non-numeric characters from the parameter string.  As a result, the original string variable should now contain numeric-only characters. 
If the number of digits in the filtered phone number is not 7 or 10, an error message should print. 
If the number of digits is 7, the number should print in the form:  xxx-xxxx
If the number of digits is 10, the number should print in the form: (xxx) xxx-xxxx
3 sample traces:
   Enter a phone number:  717.774.4464
  (717) 774-4464
 

  Enter a phone number:  774  4464
  774-4464

  Enter a phone number:  4464
  Not a valid phone number

2.  (Arrays, Searching and Sorting)  Write a complete program that receives a series of student records from the keyboard and stores them in three parallel arrays named studentID and courseNumber and grade.  All arrays are to be 100 elements.  The studentID array is to be of type int and the courseNumber and grade arrays are to be of type string.


The program should prompt for the number of records to be entered and then receive user input on how many records are to be entered.  That value should be used in an input loop to receive the series of records and store them in the parallel arrays.

Add a function to printout all records stored in the array.  Only print records that were input from the keyboard.  Much of the arrays will be unused.  Add another function to search the arrays using a specific student ID and display the student’s ID, course number, and grade wherever found, OR the message “<student ID> doesn’t exist in array”

Add code in main to print all records and prompt a user to enter a student ID and search for it in the arrays.  Test both possible outcomes.

Sample trace:

Enter the number of records to be input: 6
Enter record 1 (student ID, Course number and grade):  12 COSC175 A
Enter record 2 (student ID, Course number and grade):  15 COSC175 B
Enter record 3 (student ID, Course number and grade):  22 COSC175 C
Enter record 4 (student ID, Course number and grade):  12 ENG317  A
Enter record 5 (student ID, Course number and grade):  15 ENG317  A
Enter record 6 (student ID, Course number and grade):  12 PSYC101 A

Enter a student ID for a record search: 12
12 COSC175 A
12 ENG317 A
12 PSYC101 A

Note: If a search had been made for 17, the message “17 doesn’t exist in array” would have been displayed.


Tutor Answer

(Top Tutor) Daniel C.
(997)
School: Cornell University
PREMIUM TUTOR

Studypool has helped 1,244,100 students

8 Reviews


Summary
Quality
Communication
On Time
Value
kevin12622
Dec 5th, 2016
" Goes above and beyond expectations ! "
kiln82
Nov 26th, 2016
" awesome work thanks "
ashleyisgod
Nov 22nd, 2016
" Top quality work from this guy! I'll be back! "
likeplum4
Nov 13th, 2016
" Excellent work as usual "
Molly_Moon
Oct 30th, 2016
" AMAZING as always! "
kpcutie
Oct 21st, 2016
" Excellent job "
Hemapathy
Oct 8th, 2016
" all I can say is wow very fast work, great work thanks "
pmallory
Sep 29th, 2016
" Totally impressed with results!! :-) "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1829 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors