Help with structures

I am very confused with structures. I do not fully understand the terminology in the comments, and am completely lost with what I am doing wrong, mainly with things labeled/related to Objective 3(a,b,c). Any help is much appreciated.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
#include<iostream>
#include<iomanip>
#include<string>
#include<cctype>
using namespace std;

// Named constants for vehicle category

const string CARPOOL = "Carpool",
             FAMILY = "Family",
             SPORT = "Sport";

// TODO (Objective 1):	Replace named constants for capacity groupings with
//						the required CapacityGroup enumeration

enum CapacityGroup {CG_ERR, CG_1_2, CG_3_4, CG_5_6, CG_7_8, CG_9_12};

// Named constants for seating capacity groupings


// TODO (Objective 2):	Define the required Vehicle structure with two fields

//          category:       type string
//          occupants:      type int

struct Vehicle
{
	string category;
	int occupants;
};



// function prototype declarations
void DisplayResults(string category, int occupants);

// TODO (Objective 3a): Replace string and int paramters with 1 Vehicle structure type
Vehicle GetRecommendation(Vehicle f1);


// OPTIONAL (Idea 1a): Change return type to CapacityGroup
int GetCapacityGroup(int occupants);


// OPTIONAL (Idea 2a): Change parameter type to CapacityGroup
string GetCarpoolRecommendation(int group);
string GetFamilyRecommendation(int group);
string GetSportRecommendation(int group);




int main()
{
    /*
        DO NOT MODIFY the main() function block!
    */

    cout << endl
         << "------------------------------------------------------" << endl
         << "This program recommends a vehicle based on its purpose" << endl
         << "and the seating capacity for expected occupants." << endl
         << "------------------------------------------------------" << endl
         << endl;

    // Test Carpool category.

    cout << CARPOOL << ":" << endl;

    for(int occupants = 13; occupants >= 0; occupants--)
        DisplayResults(CARPOOL, occupants);

    cout << endl;

      // Test Family category.

    cout << FAMILY << ":" << endl;

    for(int occupants = 13; occupants >= 0; occupants--)
        DisplayResults(FAMILY, occupants);

    cout << endl;

      // Test Sport category.

    cout << SPORT << ":" << endl;

    for(int occupants = 13; occupants >= 0; occupants--)
        DisplayResults(SPORT, occupants);

    cout << endl;

      // Test unknown and not specified category

    cout << "Other:" << endl;

    DisplayResults("Vacation", 5);          // category unknown
    DisplayResults("", -1);                 // category not specified

    cout << endl << "- End Program - " << endl;
}

//------------------------------------------------------------------------------

// Function definitions

  /*  Function: DisplayResults(string category, int occupants)

      Prints occupants, and then gets and prints a recommendation.

      Parameters:

      category - incoming: A string for identifying purpose of vehicle.
      occupants - incoming: An integer indicating how many occupants are expected.

      Return value: None.
  */
void DisplayResults(string category, int occupants)
{
    // TODO (Objective 3c): Declare Vehicle structure variable

	Vehicle f1;

    // TODO (Objective 3c): Initialize Vehicle fields with function parameter values

	f1.category = category;
	f1.occupants = occupants;

    // TODO (Objective 3c): Replace function call arguments with 1 Vehicle structure variable
    string recommendation = Vehicle f1;



    cout << setw(12) << occupants << " occupants - "
         << recommendation << endl;
}

//------------------------------------------------------------------------------

/*
  Gets a capacity grouping designation based on number of occupants.

  POST CONDITION: return value is in range 1-12
  with invalid values designated CG_ERR
*/
// OPTIONAL (Idea 1a): Change return type to CapacityGroup
int GetCapacityGroup(int occupants)
{
    // OPTIONAL (Idea 1b): Change variable type to match function return type
    int group;


    if( occupants < 1 || occupants > 12 )   // invalid
        group = CG_ERR;
    else if( occupants >= 9 )               // 9-12
        group = CG_9_12;
    else if( occupants >= 7 )               // 7-8
        group = CG_7_8;
    else if( occupants >= 5 )               // 5-6
        group = CG_5_6;
    else if( occupants >= 3 )               // 3-4
        group = CG_3_4;
    else                                    // 1-2
        group = CG_1_2;

    return group;
}

//------------------------------------------------------------------------------

/*
  Gets a vehicle recommendation based on the category and number of
  occupants.

  POST CONDITION: return value is a vehicle recommendation or other message.
*/
// TODO (Objective 3a): Replace string and int parameters with 1 Vehicle parameter
Vehicle GetRecommendation(Vehicle f1)
{
    // TODO (Objective 3b): Use Vehicle fields where necessary in place of
    //						string and int parameters.
    // NOTE:				Should require 4 modifications


    // OPTIONAL (Ideas 1c/2b): Change variable type to match function return type
    // Get the capacity group for the occupants parameter.

    int group = GetCapacityGroup(f1.occupants);




    string recommendation;

    // Compare the category parameter to string constants.

    if( fcategory == CARPOOL )
    {
      recommendation = GetCarpoolRecommendation(group);
    }
    else if( category == FAMILY )
    {
      recommendation = GetFamilyRecommendation(group);
    }
    else if( category == SPORT )
    {
      recommendation = GetSportRecommendation(group);
    }
    else
    {
      recommendation = "Purpose unknown or not specified.";
    }

    return recommendation;
}

//------------------------------------------------------------------------------

/*
  Gets a vehicle recommendation for CARPOOL category based on the capacity grouping.

  POST CONDITION: return value is a vehicle recommended for this grouping, or other
  message if one cannot be determined.
*/
// OPTIONAL (Idea 2a): Change parameter type to CapacityGroup
string GetCarpoolRecommendation(int group)
{
    string recommendation;

    switch( group )
    {
      case CG_9_12:  recommendation = "Dodge Sprinter Wagon";
                     break;
      case CG_7_8:   recommendation = "Ford E-150 XL";
                     break;
      case CG_5_6:   recommendation = "Chrysler Town and Country";
                     break;

      case CG_3_4:
      case CG_1_2:   recommendation = "Consider a smaller vehicle.";
                     break;

      default: recommendation = "No recommendation for this capacity.";
    }

    return recommendation;
}

//------------------------------------------------------------------------------

/*
  Gets a vehicle recommendation for FAMILY category based on the capacity grouping.

  POST CONDITION: return value is a vehicle recommended for this grouping, or other
  message if one cannot be determined.
*/
// OPTIONAL (Idea 2a): Change parameter type to CapacityGroup
string GetFamilyRecommendation(int group)
{
    string recommendation;

    switch( group )
    {
      case CG_9_12:  recommendation = "Consider a larger vehicle.";
                     break;

      case CG_7_8:   recommendation = "Honda Odyssey";
                     break;
      case CG_5_6:   recommendation = "Buick Lucerne";
                     break;
      case CG_3_4:   recommendation = "Chevy Malibu";
                     break;

      case CG_1_2:   recommendation = "Consider a smaller vehicle.";
                     break;

      default: recommendation = "No recommendation for this capacity.";
    }

    return recommendation;
}

//------------------------------------------------------------------------------

/*
  Gets a vehicle recommendation for SPORT category based on the capacity grouping.

  POST CONDITION: return value is a vehicle recommended for this grouping, or other
  message if one cannot be determined.
*/
// OPTIONAL (Idea 2a): Change parameter type to CapacityGroup
string GetSportRecommendation(int group)
{
    string recommendation;

    switch( group )
    {
      case CG_9_12:
      case CG_7_8:
      case CG_5_6:   recommendation = "Consider a larger vehicle.";
                     break;

      case CG_3_4:   recommendation = "Ford Mustang";
                     break;
      case CG_1_2:   recommendation = "Dodge Viper";
                     break;

      default: recommendation = "No recommendation for this capacity.";
    }

    return recommendation;
}
What on earth...?
this is an assignment for an introduction to computer science class. Basically anything under "TO DO" or "Objective" can be assumed that I have done it wrong. I'm soo confused please help. I'm not looking for someone to write the code for me, as I really need to understand how to do it myself.
Topic archived. No new replies allowed.