Questions
Hello, I need to divide my code in this different parts. Use a standard approach to...

Hello, I need to divide my code in this different parts.

Use a standard approach to source files in this assignment: a .cpp for each function (you have at least two – main and ageCalc) a header file for the student struct, properly guarded

Code:

#include <iostream>

#include <string>

#include <fstream>

#include <algorithm>

#include <vector>

#include <iomanip>

using namespace std;

#define nullptr NULL

#define MAX_SIZE 100

struct Student

{

    string firstName;

    char middleName;

    string lastName;

    char collegeCode;

    int locCode;

    int seqCode;

    int age;

};

struct sort_by_age

{

    inline bool operator()(const Student *s1, const Student *s2)

    {

        return (s1->age < s2->age);

    }

};

int ageCalc(Student *studs[], Student *&youngest);

int main()

{

    Student *students[MAX_SIZE] = {nullptr};

    ifstream Myfile;

    Myfile.open("a2data.txt");

    if (!Myfile.is_open())

    {

        cout << "Could not open the file!";

        return 1;

    }

    vector<string> words;

    string line;

    while (!Myfile.eof())

    {

        getline(Myfile, line);

        line.c_str();

        int i = 0;

        string word = "";

        while (line[i] != '\0')

        {

            if (line[i] != ' ')

            {

                word = word + line[i];

                i++;

            }

            else

            {

                if (word != "")

                    words.push_back(word);

                word = "";

                i++;

            }

        }

        words.push_back(word);

    }

    Myfile.close();

    int count = 0;

    string fname = words.at(count);

    count++;

    int n = 0;

    while (count < words.size() - 2)

    {

        Student *s = new Student;

        s->firstName = fname;

        string mname = words.at(count);

        s->middleName = mname[0];

        count++;

        s->lastName = words.at(count);

        if (words.at(count).size() >= 12)

        {

            if (words.at(count)[1] >= '0' && words.at(count)[1] <= '9')

            {

                count--;

                s->middleName = ' ';

                s->lastName = words.at(count);

            }

        }

        count++;

        string id = words.at(count);

        count++;

        s->collegeCode = id[0];

        string loc = "";

        loc = loc + id[1];

        loc = loc + id[2];

        s->locCode = stoi(loc);

        string seq = "";

        for (int j = 3; j < 9; j++)

        {

            seq = seq + id[j];

        }

        s->seqCode = stoi(seq);

        string age = "";

        age = age + id[9];

        age = age + id[10];

        age = age + id[11];

        s->age = stoi(age);

        fname = id.erase(0, 12);

        students[n] = s;

        n++;

    }

    words.clear();

    sort(students, students + n, sort_by_age());

    cout << setw(15) << left << "Last Name";

    cout << setw(15) << left << "Midlle Name";

    cout << setw(15) << left << "First Name";

    cout << setw(15) << left << "College Code";

    cout << setw(12) << left << "Location";

    cout << setw(12) << left << "Sequence";

    cout << setw(12) << left << "Age" << endl;

    cout << "=======================================================================================" << endl;

    for (int i = 0; i < n; i++)

    {

        cout << setw(15) << left << students[i]->lastName;

        cout << setw(15) << left << students[i]->middleName;

        cout << setw(20) << left << students[i]->firstName;

        cout << setw(13) << left << students[i]->collegeCode;

        cout << setw(10) << left << students[i]->locCode;

        cout << setw(12) << left << students[i]->seqCode;

        cout << students[i]->age << endl;

    }

    cout << endl;

    Student *youngest = NULL;

    int avg_age = ageCalc(students, youngest);

    cout << "Average age is: " << avg_age << endl;

    cout << "Youngest student is " << youngest->firstName << " " << youngest->middleName << " " << youngest->lastName << endl;

    return 0;

}

int ageCalc(Student *studs[], Student *&youngest)

{

    youngest = studs[0];

    int i = 0;

    int avg_age = 0;

    while (studs[i] != NULL)

    {

        avg_age += studs[i]->age;

        if (youngest->age > studs[i]->age)

            youngest = studs[i];

        i++;

    }

    return avg_age / i;

}

File needed:

https://drive.google.com/file/d/15_CxuGnFdnyIj6zhSC11oSgKEYrosHck/view?usp=sharing

In: Computer Science

QUESTION 1 How many sounds are in the name "James"? (Count each occurrence of a given...

QUESTION 1

How many sounds are in the name "James"? (Count each occurrence of a given sound separately, e.g., in "bluebird" [blubɹ̩d], there would be 6 sounds -- you would count [b] twice).

3

4

5

6

0.125 points   

QUESTION 2

How many sounds are in the word "axis"? (Count each occurrence of a given sound separately, e.g., in "bluebird" [blubɹ̩d], there would be 6 sounds -- you would count [b] twice).

3

4

5

6

0.125 points   

QUESTION 3

Which of the following is a mid central unrounded lax vowel?

[ɛ]

[æ]

[ɑ]

[ʌ]

[ʊ]

0.125 points   

QUESTION 4

[b] vs [k]

these two phones are different in:

(Select all that apply)

Manner

Voicing

Place

0.125 points   

QUESTION 5

[u] vs [ʌ]
these two phones are different in:

(Select all that apply)

Tongue Height

Tongue advancement

Roundedness

Tenseness

0.125 points   

QUESTION 6

[v] vs [t]
these two phones are different in:

(Select all that apply)

Voicing

Manner

Place

0.125 points   

QUESTION 7

[æ] vs [ɑ]
these two phones are different in:

(Select all that apply)

Select one or more:

Tongue Height

Tongue advancement

Roundedness

Tenseness

0.125 points   

QUESTION 8

[ɛ] vs [æ]
these two phones are different in:

(Select all that apply)

Select one or more:

Tongue Height

Tongue Advancement

Roundedness

Tenseness

0.125 points   

QUESTION 9

[ʃ] vs [v]
these two phones are different in:

(Select all that apply)

Place

Manner

Voicing

0.125 points   

QUESTION 10

[ʤ] vs [ɡ]
these two phones are different in:

(Select all that apply)

Manner

Voicing

Place

0.125 points   

QUESTION 11

[ʧ] vs [ʤ]
these two phones are different in:

(Select all that apply)

Place

Manner

Voicing

0.125 points   

QUESTION 12

Write the English word corresponding to the following IPA transcription
[ bjuɾi ]

0.125 points   

QUESTION 13

How many sounds are in the word "towed"? (Count each occurrence of a given sound separately, e.g., in "bluebird" [blubɹ̩d], there would be 6 sounds -- you would count [b] twice).

3

4

5

6

0.125 points   

QUESTION 14

Write the English word corresponding to the following IPA transcription
[ imoʊʃən ]

0.125 points   

QUESTION 15

Type in the IPA symbol for a mid back rounded lax vowel.
Type only a single lowercase character; do not use brackets or extra spaces.

0.125 points   

QUESTION 16

Type in the IPA symbol for a voiced bilabial glide.
Type only a single lowercase character; do not use brackets or extra spaces.

0.125 points   

QUESTION 17

Type in the IPA symbol for a voiceless velar stop.
Type only a single lowercase character; do not use brackets or extra spaces.

0.125 points   

QUESTION 18

Type in the IPA symbol for a voiceless glottal stop.
Type only a single lowercase character; do not use brackets or extra spaces.

0.125 points   

QUESTION 19

Write the English word corresponding to the following IPA transcription
[ kwɑɪjətli ]

0.125 points   

QUESTION 20

Write the English word corresponding to the following IPA transcription
[ ɹɑɪd ]

0.125 points   

QUESTION 21

Write the English word corresponding to the following IPA transcription
[ ðoʊ ]

0.125 points   

QUESTION 22

What is the IPA symbol for a voiced alveolar flap?

[ ɹ ]

[ ɾ ]

[ d ]

[ t ]

[ ʔ ]

0.125 points   

QUESTION 23

Which of the following is a voiced postalveolar affricate?

[ʤ]

[s]

[z]

[ʧ]

[ʒ]

0.125 points   

QUESTION 24

What is the IPA symbol for a voiced velar nasal?

[n]

[ŋ]

[m]

[g]

[k]

In: Psychology

1. What is the purpose of the International Monetary Fund? and the Word Bank? Provide some...

1. What is the purpose of the International Monetary Fund? and the Word Bank? Provide some explanation of their practices.

2. What are the 5 levels of regional trade agreements? How do they differ from each other?

3- What are the public goods provided by international institutions?

In: Economics

GIVE A DEFINITION. PLEASE BE CLEAR OF WHICH YOU ARE DEFINING BY WRITING THE WORD NEXT...

GIVE A DEFINITION. PLEASE BE CLEAR OF WHICH YOU ARE DEFINING BY WRITING THE WORD NEXT TO THE DEFINITION

  1. INFERENTIAL STATISTICS
  2. OBSERVATIONAL STUDY
  3. EXPERIMENTAL STUDY
  4. DESCRIPTIVE STATISTICS
  5. DISCRETE VARIABLES
  6. CLUSTER SAMPLING
  7. STATISTIC
  8. SAMPLE
  9. CONVENIENCE SAMPLING
  10. RANDOM SAMPLING
  11. STRATIFIED SAMPLING
  12. MULTISTAGE SAMPLING
  13. QUANTITATIVE DATA
  14. QUALITATIVE DATA
  15. PARAMETER
  16. POPULATION

In: Statistics and Probability

the word economic forum as well as the global competitiveness ranking has adjuged the SMEs in...

the word economic forum as well as the global competitiveness ranking has adjuged the SMEs in the country to have declined steadily from 8.0% in 1980 to 2.2% in 2014
a) what reasons led to this dismal performance and even closure of businesses in the country?
b) what are the features an enterpreneur has to bear in mind before venturing into a business?

In: Finance

A binary string is a “word” in which each “letter” can only be 0 or 1...

A binary string is a “word” in which each “letter” can only be 0 or 1

Prove that there are 2^n different binary strings of length n.

Note:

  • Your goal is to produce a properly constructed proof by induction, but this does not mean you have to follow
  • Mathematical induction, step-by-step..
  • Write the statement with n replaced by k
  • Write the statement with n replaced by k+1.
  • Identify the connection between the kth statement and the (k+1)th statement.
  • Complete the induction step by assuming that the n=k version of the statement is true, and using this assumption to prove that the n=k+1 version of the statement is true.
  • Complete the induction proof by proving the base case.
  • point-by-point.
  • ANOTHER IMPORTANT NOTE:
  • Make sure you are addressing the given statement: "there are 2n different binary strings of length n” !!! So your solution should primarily be discussing binary strings. Yes, the fact that 2k+1 = 2k∙2 will be useful in your solution, but it should not be the sole content of your solution, as by itself that equality is a fact about exponents, not a fact about binary strings.

In: Advanced Math

Type a 500-600 word response to this topic to be submitted for assessment: While an immune...

Type a 500-600 word response to this topic to be submitted for assessment:

While an immune response to a pathogen such as a Covid 19 will involve many features of immunity we have learn about, a critical aspect will be the T cell response. T cells, once activated can differentiate into one of the various effector T cell subsets that are known and in particular to this conversation, the CD4 T subsets, Th1, Th2 and TH17 cells and the CD8 cytotoxic T cell subset.

Now focusing mostly on the adaptive T cell immune response to a viral infection, describe the key immunological events that would occur upon infection with a virus (generic) that would lead to a effective cytotoxic T cell response and how this would assist in clearing the virus.

In: Biology

175 word minimum and plagerism free. What are the components of a master budget? Is one...

175 word minimum and plagerism free.

What are the components of a master budget? Is one budget more important than another in a master budget? What budget do you start with in a master budget? Laurie: It might help to give an example of a company and describe their budget...Note that you could talk about the budgeting process in your own company.

In: Accounting

Define the word “ethics” as you see it. Give us an example of how that definition...

Define the word “ethics” as you see it. Give us an example of how that definition would play out in your daily life as a professional in the arena of public health.

What are some consequences that might occur if the organization’s ethics were either ignored or compromised? As a leader/manager in the organization how would you handle it?

In: Nursing

Completely work the problems in Excel, conclusions and answers may be typed in Excel or Word....

Completely work the problems in Excel, conclusions and answers may be typed in Excel or Word. Then submit the assignment via Canvas to upload the file, so I can grade an electronic version of the homework.

#1        Problem 25 [page 583-584].

The price drivers pay for gasoline often varies a great deal across regions throughout the United States.  The following data show the price per gallon for regular gasoline for a random sample of gasoline service stations for three major brands of gasoline (Shell, BP, and Marathon) located in 11 metropolitan areas across the upper Midwest region (OhioGasPrices.com website, March 18, 2012).

Metropolitan Area

Shell

BP

Marathon

Akron, OH

3.77

3.83

3.78

Cincinnati, OH

3.72

3.83

3.87

Cleveland, OH

3.87

3.85

3.89

Columbus, OH

3.76

3.77

3.79

Ft. Wayne, IN

3.83

3.84

3.87

Indianapolis, IN

3.85

3.84

3.87

Lansing, MI

3.93

4.04

3.99

Lexington, KY

3.79

3.78

3.79

Louisville, KY

3.78

3.84

3.79

Muncie, IN

3.81

3.84

3.83

Toledo, OH

3.69

3.83

3.86

Use a= 0.05 to test for any significant difference in the mean price of gasoline for the three brands.

#2        Information regarding the ACT scores of samples of students in four different majors are given below.

Student's Major

Management

Marketing

Finance

Accounting

29

22

29

28

27

22

27

26

21

25

27

25

28

26

28

20

22

27

24

21

28

20

20

19

28

23

20

27

23

25

30

24

28

27

29

21

24

28

23

29

27

31

27

24

At a 5% level of significance, test to determine whether there is a significant difference in the means of the four populations.

#3        Employees of MNM Corporation are about to undergo a retraining program. Management is trying to determine which of three programs is the best. They believe that the effectiveness of the programs may be influenced by gender. A factorial experiment was designed. You are given the following information.

Program

Gender

Male

Female

Program 1

320

380

240

300

Program 2

160

240

180

210

Program 3

240

360

290

380

Test to determine whether there is a significant difference in the means due to program type and gender, and whether significant interaction exists. Use 10% level of significance.

In: Statistics and Probability