Homework Solution: This assignment may contain elements we have not discussed, but we wil…

    C++ This assignment may contain elements we have not discussed, but we will in the coming days.
    1. Create a class called Country. It must contain 4 private attributes for the name of the country, total population (in millions), the greeting for "hello" in the native characters and spelling, and whether or not the country is mostly located in the western hemisphere. This class must contain ONLY a 4-arg constructor that will set the initial value for each attribute. Do NOT incluse a default constructor.
    2. Create only accessors for each attribute. If you wish, you may also create mutators, but we will not need them for this exercise.
    3. Create a function (NOT a method) that will take and array of Country and return the sum of total population of all Countries NOT in the western hemisphere. Call it sumPopEast(). It must accept the proper argument to process this array.
    4. Create a function (NOT a method) that will print the hello greeting of each Country in the array. Call it helloToAll().
    5. Create a function (not a method) that will return the greeting of the Country that contains the lowest population.
    6. Instantiate an array of at least 5 instances. One Country must be your native Country, at least two, must be located in the Eastern hemisphere and at least two from the Western. We will discuss how to do this. Do NOT use pointers for this assignment.
    Perfect submissions will include: A documentation section Properly commented code. A main function that properly shows the results of function calls. Other elements as discussed in class.

    Expert Answer

     
    Dear Student, here i have written the C++ program as per the requir

    C++

    This ordinance may comprise elements we entertain referable attributable attributable attributable sift-canvassed, referablewithstanding we earn in the hence days.

    1. Compose a adjust determined Dominion. It must comprise 4 individual qualitys ce the designate of the dominion, completion population (in millions), the congratulation ce “hello” in the vernacular characters and spelling, and whether or referable attributable attributable attributable the dominion is coercion-the-most-part located in the western hemisphere. This adjust must comprise ONLY a 4-arg creator that earn determined the primal esteem ce each quality. Do NOT inclcorrection a failure creator.
    2. Compose solely accessors ce each quality. If you wish, you may so compose mutators, referablewithstanding we earn referable attributable attributable attributable want them ce this training.
    3. Compose a administration (NOT a arrangement) that earn conduct and arrange of Dominion and repay the mix of completion population of complete Countries NOT in the western hemisphere. Ccomplete it mixPopEast(). It must recognize the peculiar reasoning to regularity this arrange.
    4. Compose a administration (NOT a arrangement) that earn imimprint the hello congratulation of each Dominion in the arrange. Ccomplete it helloToAll().
    5. Compose a administration (referable attributable a arrangement) that earn repay the congratulation of the Dominion that comprises the lowest population.
    6. Instantiate an arrange of at meanest 5 instances. One Dominion must be your vernacular Dominion, at meanest brace, must be located in the Eastern hemisphere and at meanest brace from the Western. We earn sift-canvass how to do this. Do NOT correction pointers ce this ordinance.

    Perfect submissions earn include:

    A documentation section

    Suitably expounded decree.

    A main administration that peculiarly shows the results of administration calls.

    Other elements as sift-canvassed in adjust.

    Expert Reply

     

    Dear Student,

    here i entertain written the C++ program as per the requirement.I entertain so inclueded the expound ce amend agreement.

    —————————————————————————————————————————————-

    Note: Please referable attributable attributablee that the beneath program has been tested on ubuntu 16.04 arrangement and compiled beneath g++ compiler. This decree earn so composition on other IDE’s and C++ microsoft visual studio pointed.

    ——————————————————————————————————————————————

    Program:

    —————————————————————————————————————————————–

    //Header file

    #include<iostream>

    //namespace declration

    using designatespace std;

    //calass declration

    adjust Dominion

    {

    //component shifting declration

    private:

    string designate;

    int population;

    string greet;

    char CH;

    public:

    //shifting grounds cast declration

    int i,l, mix = 0;

    //creator declration

    Country(string N, int P, string G, char C)

    {

    designate = N;

    population = P;

    greet = G;

    CH = C;

    }

    //creating accessors

    string determinedName(string S)

    {

    designate = S;

    }

    int determinedPopulation(int Pop)

    {

    population = Pop;

    }

    string determinedGreet(string Greet)

    {

    greet = Greet;

    }

    char determinedChar(char c)

    {

    CH = c;

    }

    //finding the mix of population

    int mixPopEast(int arrange[])

    {

    for(i=0; i< 5; i++)

    {

    mix = mix + arrange[i];

    }

    repay mix;

    }

    //component administration helloToAll()

    string helloToAll(string arr1[], string arr2[])

    {

    for(i=0;i<5;++i)

    {

    cout<<arr2[i]<<” : “<<arr1[i]<<endl;

    }

    }

    //definition ce the lowestPop administration

    int lowestPop(int arrange[])

    {

    int min = arrange[0];

    for(i=0;i< 5; i++)
    {

    if(array[i]<min)

    {

    min = arrange[i];

    l = i;

    }
    repay l;
    }

    }

    };

    //main administration

    int main()

    {

    //arrange primalizations

    string designate[5] = {“India”, “Thailand”, “Kenya”, “USA”, “Portugal”};

    int L;

    int Pop[5] = {50, 5, 10, 20, 30};

    string Greet[] = {“Namste!”, “Wai!”, “Adamu!”, “Hello!”, “Hola”};

    char CH[5] = {‘N’, ‘Y’, ‘N’, ‘Y’, ‘Y’};

    //creatring creator object

    Dominion C1(“India”, 100, “Hello”, ‘N’);

    //Calling the component administrations

    cout<<“Mix of Population is : “<<C1.sumPopEast(Pop)<<endl;

    cout<<“Congratulation of each dominion is: “<<endl;

    //cout<<C1.helloToAll(Greet, designate)<<endl;

    cout<<“Dominion with the lowest population is: “<<endl;

    L = C1.lowestPop(Pop);
    cout<<name[L]<<endl;

    repay 0;

    }