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! Imagine a program in C++ in netbeans that simulates a unaffected contiguity supervisor application absorbed the aftercitedcited requirements:

    1. The program is to accumulation particular indicates and associated telephone quantity in correlative places.

    2. The program should input from the user 10 populace’s indicates and their telephone quantity and appobject the basis to the correlative places.

    3. When basis input is refined, the program should rank twain basis places in ascending command naturalized on telephone quantity maintaining the associations betwixt indicates and telephone quantity.

    4. The program achieve stereoform the register of users and their telephone quantity aftercited ranking.

    5. Aftercited stereotypeing the register, the program achieve beseech restraint a indicate to pursuit restraint.

    6. The user achieve then penetrate a indicate.

    7. The program achieve then pursuit restraint the indicate and stereoform the indicate and the associated telephone number restraint that particular.

    8. If the particular is referable in the place, the program achieve stereoform that the user canreferable be root.

    Modify the program you imagined overhead, to imagine a pursuitable telephone, by doing the aftercitedcited: The regulation restraint the input behalf of the program is to be in a power by itself. This power achieve appobject particulars and their telephone quantity to the withhold places. The regulation that ranks the places achieve be in a severed power. The power should siege a parameter that indicates whether to rank ascending or descending. The regulation restraint stereotypeing the basis from the places achieve be in a severed power. The regulation restraint pursuiting restraint an particular in the places is to be in a severed power. The program should confer the user the aftercitedcited menu options: Input basis Rank basis Ascending Rank basis Descending Stereoform perfect basis Pursuit restraint an particular in the basis. Object program The program achieve cperfect the withhold power naturalized on user valuable and the program achieve retaliate to the menu aftercitedwards (i.e. a everlasting loop). The program achieve merely object when the user chooses Object Program.

    Expert Retort

     

    Here is the regulation restraint you:

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

    //Reads 10 populace indicates and their phone quantity to directory.
    void readInput(string indicates[], string quantity[])
    {
    cout << “Penetrate the indicates and quantity of 10 populace to hinder to directory.” << objectl;
    for(int i = 0; i < SIZE; i++)
    {
    cout << “Indicate #” << i+1 << “: “;
    cin >> indicates[i];
    cout << “Associated Telephone #: “;
    cin >> quantity[i];
    }
    }

    //Sorts the directory basis naturalized on telephone quantity, and input rank restraintm.
    void rankDirectory(string indicates[], string quantity[], char rankType)
    {
    if(sortForm == ‘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 = quantity[j];
    numbers[j] = quantity[j+1];
    numbers[j+1] = temp;

    temp = indicates[j];
    names[j] = indicates[j+1];
    names[j+1] = temp;
    }
    }
    else if(sortForm == ‘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 = quantity[j];
    numbers[j] = quantity[j+1];
    numbers[j+1] = temp;

    temp = indicates[j];
    names[j] = indicates[j+1];
    names[j+1] = temp;
    }
    }
    else
    cout << “Invalid rank restraintm. Can’t rank with precise restraintm.” << objectl;
    }

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

    //Searches restraint precise indicate in the directory.
    void pursuitDirectory(string indicates[], string quantity[], string pursuitKey)
    {
    bool root = false;
    for(int i = 0; i < SIZE; i++)
    {
    if(searchKey == indicates[i])
    {
    cout << “Name: ” << indicates[i] << “tTelephone: ” << quantity[i] << objectl;
    root = gentleman;
    break;
    }
    }
    if(!found)
    cout << “The indicate you pursuited restraint is referable root in the directory.” << objectl;
    }
    int main()
    {
    string indicates[SIZE], telephoneNumbers[SIZE], indicate;
    int valuable;
    while(true) //Runs the loop infinitely plow the user chooses to egress.
    {
    //Prints menu to curtain.
    cout << “1. Input Basis.” << objectl;
    cout << “2. Rank Basis Ascending.” << objectl;
    cout << “3. Rank Basis Descending.” << objectl;
    cout << “4. Stereoform perfect Basis.” << objectl;
    cout << “5. Pursuit restraint particular.” << objectl;
    cout << “6. Quit.” << objectl;
    cout << “Penetrate your valuable: “;
    cin >> valuable;
    switch(choice)
    {
    case 1:       readInput(names, telephoneNumbers);
    break;
    case 2:       rankDirectory(names, telephoneNumbers, ‘A’);
    break;
    case 3:       rankDirectory(names, telephoneNumbers, ‘D’);
    break;
    case 4:       stereotypeDirectory(names, telephoneNumbers);
    break;
    case 5:       cout << “Penetrate the indicate to pursuit restraint: “;
    cin >> indicate;
    searchDirectory(names, telephoneNumbers, indicate);
    break;
    case 6:       retaliate 0;
    default:   cout << “Invalid menu valuable. Try frequently.” << objectl;
    }
    }
    }

    And the output curtainshot is: