Function Implementation

Hello;
I am having trouble Implementing this functions:

1. Cafeteria::pickTray()in cafeteria.cpp
2. Overloaded output operator of Group in group.cpp
3. Student::genPrice() in student.cpp.

for an assignment. My headers and .cpp snippets are
group.h
#ifndef A4TEMPLATE_GROUP_H
#define A4TEMPLATE_GROUP_H
#include <string>
#include <queue>
#include "student.h"
#include <iostream>

namespace a1_template
{

class Group
{
public:
Group(std::string grColor) : color(grColor), price(0) {};
void addStudent(const Student& s) {if (s.getGroup() == color) {
price+=s.getPrice(); students.push(s);} };
friend std::ostream& operator<<(std::ostream& os, Group& g);
private:
std::string color;
std::queue<Student> students;
double price;
};
}

#endif
//------------------
Cafeteria.cpp
//--
void Cafeteria::pickTray()
{
Group redg("red"), greeng("green"), blueg("blue");
/*
for each student in the queue
1 pick a tray
1.1 randomly select a stack (as #1 tray)
1.2 pop #1 stack and push #2 stack until find the desired color
1.3 if no tray is found, pop #2 stack and push #1 stack and continue to find the tray of desired color
1.4: if no tray is found, pick the top one of #1 stack.
2. identify the color of the picked tray
3. push the student into the queue/stack of the corresponding group
*/
}
//---
Student.cpp
//---
void Student::genPrice()
{

}
//---
student.h
//--
class Student
{
public:
Student(std::string stName, std::string stGroup, int stOunceSalad, std::string stEntree, std::string stDessert) :
name(stName), group(stGroup), ouncesSalad(stOunceSalad), entreeName(stEntree), dessertName(stDessert), price(0) { genPrice();};
friend std::ostream& operator<<(std::ostream& os, const Student& s);
std::string getGroup() const { return group; };
std::string getName() const {return name;};
double getPrice() const {return price;};
private:
void genPrice();
std::string name;
std::string group;
int ouncesSalad;
std::string entreeName;
std::string dessertName;
double price;
};

//--


please help!
Why is Group in namespace a1_template?
I'm sorry that is supposed to say A4_template!
Why s namespace at all?
Topic archived. No new replies allowed.