#include<iostream>
#include<string>
using namespace std;
class Employee
{
private:
    string name;
    string department;
    double salary;
public:
Employee(string n, string d, double s): name(n), department (d), salary (s) {}
bool inpytSalary() 
{
    cout<<"Enter salary:";
    if(!(cin >>salary))
    {
        cin.clear();
        cin.ignore(10000, ' ');
        cout<<"Invalid input"<<endl;
        return false;
    }
    if(salary<0)
    {
        cout<<"Salary cannot be negative"<<endl;
        return false;
    }
        return true;
}
void display()const
{
    cout<<"Name :"<<name <<endl;
    cout<<"Department:"<<department<<endl;
    cout<<"Salary :"<<salary<<endl;
}
double getSalary() const 
{
    return salary;
}
};
int main()
{
    cout<<"Sample Input 1"<<endl;
    Employee emp1("Alice","IT",0);
    emp1.inputSalary();
    emp1.display();
    cout<<"Sample Input 2"<<endl;
    Employee emp2("Bob","HR",0);
    cout<<"Enter salary:";
    string invalid = "abc";
    cin>>invalid input"<<endl;
    cout<<"Department:IT"<<endl;
    cout<<"Salary :5000"<<endl;
    cout<<"Sample Output 2"<<endl;
    cout<<"Invalid input"<<endl;
    return 0;
}