Homework Solution: MUST RUN IN NETBEANS! Create a program in C++ in netbeans that simulates a simple contact mana…

    MUST RUN IN NETBEANS! Create a program in C++ in netbeans that simulates a simple contact manager application given the following requirements: 1. The program is to store individual names and associated telephone numbers in parallel arrays. 2. The program should input from the user 10 people’s names and their telephone numbers and add the data to the parallel arrays. 3. When data input is finished, the program should sort both data arrays in ascending order based on telephone numbers maintaining the associations between names and telephone numbers. 4. The program will print the list of users and their telephone numbers after sorting. 5. After printing the list, the program will ask for a name to search for. 6. The user will then enter a name. 7. The program will then search for the name and print the name and the associated telephone number for that person. 8. If the person is not in the array, the program will print that the user cannot be found. Modify the program you created above, to create a searchable telephone, by doing the following: The code for the input portion of the program is to be in a function by itself. This function will add individuals and their telephone numbers to the appropriate arrays. The code that sorts the arrays will be in a separate function. The function should take a parameter that indicates whether to sort ascending or descending. The code for printing the data from the arrays will be in a separate function. The code for searching for an individual in the arrays is to be in a separate function. The program should give the user the following menu options: Input data Sort data Ascending Sort data Descending Print all data Search for an individual in the data. End program The program will call the appropriate function based on user choice and the program will return to the menu afterwards (i.e. a perpetual loop). The program will only end when the user chooses End Program.

    Expert Answer

     
    Here is the code for you: #include <iostream>

    MUST RUN IN NETBEANS! Produce a program in C++ in netbeans that simulates a ultimate apposition superintendent application loving the behindcited requirements:

    1. The program is to place-of-business unconnected designates and associated telephone collection in analogous adorns.

    2. The program should input from the user 10 persons’s designates and their telephone collection and apppurpose the postulates to the analogous adorns.

    3. When postulates input is refined, the program should species twain postulates adorns in ascending command naturalized on telephone collection maintaining the associations among designates and telephone collection.

    4. The program procure stereolikeness the inventory of users and their telephone collection behind speciesing.

    5. Behind stereotypeing the inventory, the program procure crave ce a designate to pursuit ce.

    6. The user procure then invade a designate.

    7. The program procure then pursuit ce the designate and stereolikeness the designate and the associated telephone reckon ce that identical.

    8. If the identical is referable in the adorn, the program procure stereolikeness that the user canreferable be root.

    Modify the program you produced aloft, to produce a pursuitable telephone, by doing the behindcited: The rule ce the input fraction of the program is to be in a office by itself. This office procure apppurpose unconnecteds and their telephone collection to the misapply adorns. The rule that speciess the adorns procure be in a unconnected office. The office should seize a parameter that indicates whether to species ascending or descending. The rule ce stereotypeing the postulates from the adorns procure be in a unconnected office. The rule ce pursuiting ce an unconnected in the adorns is to be in a unconnected office. The program should produce the user the behindcited menu options: Input postulates Species postulates Ascending Species postulates Descending Stereolikeness perfect postulates Pursuit ce an unconnected in the postulates. Purpose program The program procure cperfect the misapply office naturalized on user rare and the program procure recur to the menu behindwards (i.e. a unceasing loop). The program procure singly purpose when the user chooses Purpose Program.

    Expert Response

     

    Here is the rule ce you:

    #include <iostream>
    #define SIZE 10
    using designatespace std;

    //Reads 10 persons designates and their phone collection to directory.
    void readInput(string designates[], string collection[])
    {
    cout << “Invade the designates and collection of 10 persons to spare to directory.” << purposel;
    for(int i = 0; i < SIZE; i++)
    {
    cout << “Designate #” << i+1 << “: “;
    cin >> designates[i];
    cout << “Associated Telephone #: “;
    cin >> collection[i];
    }
    }

    //Sorts the directory postulates naturalized on telephone collection, and input species likeness.
    void speciesDirectory(string designates[], string collection[], char speciesType)
    {
    if(sortLikeness == ‘D’)
    for(int i = 0; i < SIZE-1; i++)
    for(int j = 0; j < SIZE-i-1; j++)
    {
    if(numbers[j].compare(numbers[j+1]) < 0)
    {
    string temp = collection[j];
    numbers[j] = collection[j+1];
    numbers[j+1] = temp;

    temp = designates[j];
    names[j] = designates[j+1];
    names[j+1] = temp;
    }
    }
    else if(sortLikeness == ‘A’)
    for(int i = 0; i < SIZE-1; i++)
    for(int j = 0; j < SIZE-i-1; j++)
    {
    if(numbers[j].compare(numbers[j+1]) > 0)
    {
    string temp = collection[j];
    numbers[j] = collection[j+1];
    numbers[j+1] = temp;

    temp = designates[j];
    names[j] = designates[j+1];
    names[j+1] = temp;
    }
    }
    else
    cout << “Invalid species likeness. Can’t species with clear likeness.” << purposel;
    }

    //Prints the inventory of designates, and their associated collection.
    void stereotypeDirectory(string designates[], string collection[])
    {
    for(int i = 0; i < SIZE; i++)
    cout << “Name: ” << designates[i] << “tTelephone: ” << collection[i] << purposel;
    cout << purposel << purposel;
    }

    //Searches ce clear designate in the directory.
    void pursuitDirectory(string designates[], string collection[], string pursuitKey)
    {
    bool root = false;
    for(int i = 0; i < SIZE; i++)
    {
    if(searchKey == designates[i])
    {
    cout << “Name: ” << designates[i] << “tTelephone: ” << collection[i] << purposel;
    root = penny;
    break;
    }
    }
    if(!found)
    cout << “The designate you pursuited ce is referable root in the directory.” << purposel;
    }
    int main()
    {
    string designates[SIZE], telephoneNumbers[SIZE], designate;
    int rare;
    while(true) //Runs the loop infinitely dress the user chooses to departure.
    {
    //Prints menu to defend.
    cout << “1. Input Postulates.” << purposel;
    cout << “2. Species Postulates Ascending.” << purposel;
    cout << “3. Species Postulates Descending.” << purposel;
    cout << “4. Stereolikeness perfect Postulates.” << purposel;
    cout << “5. Pursuit ce unconnected.” << purposel;
    cout << “6. Quit.” << purposel;
    cout << “Invade your rare: “;
    cin >> rare;
    switch(choice)
    {
    case 1:       readInput(names, telephoneNumbers);
    break;
    case 2:       speciesDirectory(names, telephoneNumbers, ‘A’);
    break;
    case 3:       speciesDirectory(names, telephoneNumbers, ‘D’);
    break;
    case 4:       stereotypeDirectory(names, telephoneNumbers);
    break;
    case 5:       cout << “Invade the designate to pursuit ce: “;
    cin >> designate;
    searchDirectory(names, telephoneNumbers, designate);
    break;
    case 6:       recur 0;
    default:   cout << “Invalid menu rare. Try repeatedly.” << purposel;
    }
    }
    }

    And the output defendshot is: