/*
    struct is a bag of data
*/

#include <iostream>
#include <string>
using namespace std;


struct Employee
{
    string name;
    string department;
    int age;
    double salary,tax;
};


void PrintEmployee(const Employee& you)   // Const reference
{
   cout << "name=" << you.name << endl;
   cout << "department=" << you.department << endl;
   cout << "age=" << you.age << endl;
   cout << "salary=" << you.salary << endl;
   cout << "tax=" << you.tax << endl;
}


void WriteAfterTax(const Employee& you)  // Const reference
{
   cout << "Salary after tax for " << you.name << "   salary=" << you.salary*you.tax << endl;
}

void SetEmployee(Employee &you, string name, string department, int age, double salary, double tax) // Employee must be ref to be changed.
// void SetEmployee(Employee &you, const string& name, const string& department, int age, double salary, double tax) // Transfer strings as const ref
{
    you.name=name;
    you.department=department;
    you.age=age;
    you.salary=salary;
    you.tax=tax;
}


int main()
{
    Employee Emma, Mogens;
    
    Emma.name="Emma Thompson";
    Emma.department="FKF";
    Emma.age=42;
    Emma.salary=25000.0;
    Emma.tax=0.42;

    cout << "Emma: " << Emma.name << "  " << Emma.department << endl;


    SetEmployee(Mogens, "Mogens Glistrup", "BMB", 58, 15000.0, 0.33);
    PrintEmployee(Mogens);

    WriteAfterTax(Emma);
    WriteAfterTax(Mogens);
}


